36 - INSERTION OF AN ELEMENT INTO AN ARRAY AT SPECIFIC POSITION - C PROGRAMMING

  Рет қаралды 232,858

Sundeep Saradhi Kanthety

Sundeep Saradhi Kanthety

Күн бұрын

Major Operations that can be performed on arrays are
1. Insertion
2. Deletion
3. Sorting
4. Searching
This video explains the process of inserting an element into an array at specified position.
User have to specify the position where the element to be inserted and the element which to be inserted.
Here POSITION given by user is the INDEX value.

Пікірлер: 206
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
Hi Friends There is a Little mistake in the second for loop please make a notice the condition has been written wrong as i=position. Sorry for the mistake. Please make a notice and correct it.
@mohitmishra9882
@mohitmishra9882 5 жыл бұрын
Thanks sir
@prakashpanda2702
@prakashpanda2702 5 жыл бұрын
It's ok sir you r great
@ITACHI-og6nu
@ITACHI-og6nu 5 жыл бұрын
Can you please make an other video clearly explaining it in another way???
@truepatriot7355
@truepatriot7355 5 жыл бұрын
Yes sir I had realised that at the same time. Thank you
@junaidhashmat1427
@junaidhashmat1427 5 жыл бұрын
is there no need to increment in the total index of the array??
@ajayvs4919
@ajayvs4919 4 жыл бұрын
I have got to say this, You're teaching is absolutely perfect. I've never before understood a program on the first go. Thanks a lot and keep up the good work!
@gauravchandra8774
@gauravchandra8774 5 жыл бұрын
Sir in the 2nd for loop u did the mistake on sign it should be i>=position
@karansharma9388
@karansharma9388 3 жыл бұрын
Bro can u send the coorrect program
@CENTRALVOICE
@CENTRALVOICE 3 жыл бұрын
i>=position ok
@CENTRALVOICE
@CENTRALVOICE 3 жыл бұрын
@@karansharma9388 #include int main(){ int ary[20], i, num, position, element; printf("Enter number of Array Sizes :"); scanf("%d", &num); for(i=0; i=position; i--){ ary[i+1]=ary[i]; } ary[position] = element; for(i=0; i
@jyothic8347
@jyothic8347 3 жыл бұрын
@@CENTRALVOICE learnt concept frm sir, copied program frm u😂
@-BaljinderSingh
@-BaljinderSingh 2 жыл бұрын
i>=pos-1
@johnchamba9181
@johnchamba9181 4 жыл бұрын
He is really helping me in data structure
@prateeklohani
@prateeklohani 4 жыл бұрын
This is the Best playlist available on KZbin on C Programing
@priyanshupandey6568
@priyanshupandey6568 4 жыл бұрын
Sir first time i thought that your tuturiol will be boring because they have no practical explanation so I always watched #smartprogramming videos but now I realised that you are the best 👍👍👍👍
@sundeepsaradhi
@sundeepsaradhi 7 жыл бұрын
hi viewers Small correction in the above program. here POSITION is the index value for an element.
@sundeepsaradhi
@sundeepsaradhi 7 жыл бұрын
+Sundeep Saradhi
@ajwadmajed3551
@ajwadmajed3551 7 жыл бұрын
you saved my life thank you
@paras_sachdeva
@paras_sachdeva 2 жыл бұрын
I specially came to the comments section to check this. Thanks :)
@SmartProgramming
@SmartProgramming 5 жыл бұрын
nicely explained sir, keep it up, thank you 👍👍👍👍🙂🙂🙂🙂
@jsoliz1806
@jsoliz1806 3 жыл бұрын
yoooooo thanks Sundeep this is just what I was looking for!
@bhuwanghimire966
@bhuwanghimire966 4 жыл бұрын
there is a little mistake so the correct loop will be : for(i=r-1;i>=pos-1;i--) a[i+1]=a[i]; a[pos-1]=element; printf("result is : "); for (i=0;i
@ShivamMishra-ke6gi
@ShivamMishra-ke6gi 4 жыл бұрын
Bhaii sir jo h index ko hi position man k baithe h agr tumhare hisab se kre to index alg hoga positiion alg
@ammankhan3370
@ammankhan3370 4 жыл бұрын
@KaPiL TaLi r ka mtlb no of element
@srinivasaraok5919
@srinivasaraok5919 4 жыл бұрын
It is very helpful and nice explanation
@shravanparnandi3890
@shravanparnandi3890 5 жыл бұрын
TanQ u sir. I just watched ur 2 topics. Very clear explaination ☺🙏
@fardinahmed9602
@fardinahmed9602 3 жыл бұрын
You are a really good man and teacher
@shyamnarayananj4480
@shyamnarayananj4480 2 жыл бұрын
In the 3rd for loop it is i
@himanshujain2526
@himanshujain2526 Жыл бұрын
thank you so much sir for making my concept crystal clear 🙏
@soumyarkaghosh8028
@soumyarkaghosh8028 2 жыл бұрын
sir, it should be for(i=4; i>= position; i--)
@drarunanoopm6777
@drarunanoopm6777 Жыл бұрын
Sir your class is really great.
@GurpreetSingh-km6sx
@GurpreetSingh-km6sx 5 жыл бұрын
One of the best tutorial videos online! Thanx a lot sir for this amazing tutorial!!
@himanshushekhar4590
@himanshushekhar4590 Жыл бұрын
Very well explained!
@nikhilranjankumar4151
@nikhilranjankumar4151 4 жыл бұрын
How can you add an element to a[5] when the size is 5. It can only hold elements from 0 to 4
@sundeepsaradhi
@sundeepsaradhi 4 жыл бұрын
That is the drawback in arrays it doesn't have any boundaries
@accxor6561
@accxor6561 3 жыл бұрын
@@sundeepsaradhi In my case it is printing arrayindexoutofbounds exception
@allsportsnews7430
@allsportsnews7430 2 жыл бұрын
He skipped the other part which is increase the size of an array
@BALRAJSINGH-ox8jy
@BALRAJSINGH-ox8jy 6 жыл бұрын
It helped me very much thank you so much for this👍
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi balraj thanks for your interest towards our channel and share my sessions with your friends and subscribe to our channel.Keep following our channel.
@ganeshjaggineni4097
@ganeshjaggineni4097 2 жыл бұрын
NICE SUPER EXCELLENT MOTIVATED
@pawanyadav5191
@pawanyadav5191 4 жыл бұрын
Gajab sir ji Maja aa gaya
@saisriharshayellaboyina2434
@saisriharshayellaboyina2434 3 жыл бұрын
Sir why you are decremented the ' i' value from last before step??
@rohithprasad8423
@rohithprasad8423 4 жыл бұрын
This content is very helpful to me 😊
@sujiiedits3124
@sujiiedits3124 2 жыл бұрын
Hlo sir I understood u r lesson on array very nycly
@abhisheksachdeva9397
@abhisheksachdeva9397 5 жыл бұрын
Awesome explanation . Very helpful. Thank you sir.
@roaringwildlife1954
@roaringwildlife1954 2 жыл бұрын
Well said sir i understood clearly thankyou
@uff_statuss_
@uff_statuss_ 2 жыл бұрын
Nyc video ❤️
@tuhinsaha2011
@tuhinsaha2011 4 жыл бұрын
Sir in last you have made a mistake it should be >=
@sandipdeb5859
@sandipdeb5859 6 жыл бұрын
thank you sir , really helpfull.
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi sandip thanks for your interest towards our channel and share my sessions with your friends and subscribe to our channel.Keep following our channel.
@nasir1349
@nasir1349 5 жыл бұрын
awesome....explanation..
@rajendrasashamal3454
@rajendrasashamal3454 5 жыл бұрын
In this program our main purpose to insert an element . Why we replaced two element . Can't we insert the element replace by that specific position that we required. Sir please confirm me plz
@ItEngineer1998
@ItEngineer1998 5 жыл бұрын
If u insert element directly what about element which is already present in that position.you have to make space for that element.
@dynamicsid8795
@dynamicsid8795 5 жыл бұрын
Well explain Dil jeetane liya
@parthdabheliya6509
@parthdabheliya6509 5 жыл бұрын
best way to teach
@parthasaradhihoney8093
@parthasaradhihoney8093 Жыл бұрын
We should increase the n value or directly we can represent the next index value i[5]
@ashashreesarma2319
@ashashreesarma2319 3 жыл бұрын
Should there be a condition loop where it is checked that the position is less than the total size of the array. Otherwise the program may show error
@user-qv6hh8vp1u
@user-qv6hh8vp1u 4 жыл бұрын
Hi, thanks for your nice videos, please teach me how to calculate integrals in c if possible
@jagdishrathod1236
@jagdishrathod1236 3 жыл бұрын
Sir, bere the size of aaray firstly is 5 . We know the size of aaray is static (we can't change it), but here in this program next time size become 6 and we print 6 elements.. How it's possible??
@imdexter3785
@imdexter3785 6 жыл бұрын
Brilliant work bro
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi dexter thanks for watching my sessions and interest towards our channel.
@jallapavan
@jallapavan 6 жыл бұрын
thank you sir for your effort appericiate you for your effforts
@MrRavindra4
@MrRavindra4 4 жыл бұрын
Thank you Sir. you cleared my doubt
@kreativevideos786
@kreativevideos786 4 жыл бұрын
Hello Sir, This thing is not possible in java right? For this we would likely get arrayindexoutofbounds exception then how to do insertion in java?
@padhmavathi7333
@padhmavathi7333 4 жыл бұрын
Yes sir i am also trying
@RITESHKUMAR-co7uf
@RITESHKUMAR-co7uf 5 жыл бұрын
Sir position and index values are different things. I am getting confused position, index.
@anubhagaur6334
@anubhagaur6334 6 жыл бұрын
As per my knowledge sir we can't change the size right as size of an array is fixed i .e. 5 but you have change it to 6
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
Hi Anubha Gaur here the limitation of arrays is we cant set the boundary to arrays. If you declare a[ 3] it can store 3 elements but u can read 4 th element also.once try it and let me know.
@kedarparab8001
@kedarparab8001 4 жыл бұрын
dont take 6 elements and insert take large array and then insert
@saiprakash2514
@saiprakash2514 5 жыл бұрын
Am getting the answer attached with an garbage value when i used last for loop with 'n+1'.But when i used only 'n' i was getting the perfect answer.So,i think its wrong there.
@optimistichomosapien7484
@optimistichomosapien7484 3 жыл бұрын
Great explanation ♥️
@TausifAnsari-jw7le
@TausifAnsari-jw7le 5 жыл бұрын
Awesome 👌
@jaan7811
@jaan7811 7 ай бұрын
If the array is set a[5] at the beginning, how can you insert a sixth element into the array?
@dr.arthurgreen7198
@dr.arthurgreen7198 3 жыл бұрын
Thank u sir
@nahiansiddique7308
@nahiansiddique7308 5 жыл бұрын
i>=position & ara[i+1]=ara[i] >>>>>>> ara[i-1]=ara[i] & ara[position-1]=element;
@user-ls8ij1bz1l
@user-ls8ij1bz1l 6 ай бұрын
Sir in this problem we first declared the size as 5. After insertion the size will be 6. Is it possible to insert an element without deletion of the last element
@ashishranjansinha2316
@ashishranjansinha2316 5 жыл бұрын
Gud explanation sir👏👏👏
@sanchitsharma_True
@sanchitsharma_True 4 жыл бұрын
Don't you this that in case of general situation: for(i=size; i>pos; i--) { arr[i]=arr[i-1]; } above condition is favorable for insertion because a[i+1] = a[i]; this statement create an n+1 array suppose, size = 5 then by a[i+1] = a[i]; a[6] = a[5] and here a[6] doesn't created by us.
@shalupathak6905
@shalupathak6905 5 жыл бұрын
Sir ji tussi great ho ❤️❤️🙏🙏🙏🙏
@aryangrover7216
@aryangrover7216 4 жыл бұрын
Sir One More Doubt Please help everyone as my exam is very near. As you have declared array of array[5] and then in second loop you have declared array[5]=array[4] then array[5] is not there na. Where we have incremented value of n
@sundeepsaradhi
@sundeepsaradhi 4 жыл бұрын
Hi That's what the disadvantage in arrays even though we declare 5 (0 to 4 index) elements in array, we can access beyond the index 4. Hope your doubt has been clarified.
@suryapadala54
@suryapadala54 4 жыл бұрын
O reaally
@increadibleangel7980
@increadibleangel7980 6 жыл бұрын
NICE ONE
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
Hi Thanks for your interest towards our channel and share my sessions with your friends and keep following our channel and don't forget to subscribe to our channel.
@worldfromhome4033
@worldfromhome4033 2 жыл бұрын
I don't get one thing. When size of array is 3 then max index we can access is 2 so when we do arr[i+1] for i=2 we are assigning a value to arr[3] .. shouldn't this give error? However the program seems to be working fine in compiler
@sundeepsaradhi
@sundeepsaradhi 2 жыл бұрын
No it doesn't return any error and thats the disadvantage of array
@elizabeths6391
@elizabeths6391 6 жыл бұрын
super sir. please make a video for merge the two array elements in one array
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi Elizebeth definitely i will try to upload the program with in two or three days.
@lakshaysharma8919
@lakshaysharma8919 6 жыл бұрын
Hello sir actually I can't understand why have u taken i
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
Hi mask before insertion the elements are 5 with indexed i=0,1,2,3,4. So i have written the condition i
@sheikhsayeed
@sheikhsayeed 5 жыл бұрын
Thank you .
@ramkiram5414
@ramkiram5414 6 жыл бұрын
Sir can u please explain wit one example sir.. I learn sorting from your channel only sir. I get them easily , bcz u have done wit example also. That's y I'm asking one example for this insertion pgm sir.
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi sriram sure i willl try to upload it soon. thanks for your interest towards our channel and share my sessions with your friends and subscribe to our channel.Keep following our channel.
@medapatigaayathre4229
@medapatigaayathre4229 3 жыл бұрын
Sir u wrote array of size 5 but we are adding one more element to it we declared size 5 will it consider or should take big size and consider 5 elements??
@srinidhisn6134
@srinidhisn6134 2 жыл бұрын
Sir write algorithm and explain once in step wise
@bharathvijayp3276
@bharathvijayp3276 Жыл бұрын
sir how to insert two element in the array
@swathi394
@swathi394 3 жыл бұрын
Sir this data structure course is suitable for electrical students I mean it covers the syllabus or not .... please reply sir
@ShivamYadav-cb6ed
@ShivamYadav-cb6ed 5 жыл бұрын
In the declared array their is not any vacant place then where the new element will stored it is the situation of overflow Am i right or not?? Plese tell me sir!
@rajeshbainaboina7950
@rajeshbainaboina7950 4 жыл бұрын
Elements of an array means we want to give elements right ? So it will automatically went to their positions right ?
@sundeepsaradhi
@sundeepsaradhi 4 жыл бұрын
Yes we have to read elements using input function
@rajeshbainaboina7950
@rajeshbainaboina7950 4 жыл бұрын
@@sundeepsaradhi so we don't need to use printf function to display it automatically it will be displayed right ?
@rajeshbainaboina7950
@rajeshbainaboina7950 4 жыл бұрын
@@sundeepsaradhi so we don't need to use printf function to display it automatically it will be displayed right ?
@jayanthivikas7478
@jayanthivikas7478 4 жыл бұрын
Sir instead of moving elements can we replace the element in that position sir
@elizabeths6391
@elizabeths6391 6 жыл бұрын
hello sir iam understand clearly to insert the elements in an array but, when iam trying to practice in my laptop but in that, when iam reading example printf("enter the ele of arr: "); for(i=0;i
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi coming to this above said program you have to read the value of n and then you have to use it in for loop. printf("enter the ele of arr: "); scanf("%d",&n); /* include this statement*/ for(i=0;i
@Bhargav1245-g7dc
@Bhargav1245-g7dc 4 жыл бұрын
Sir writing in c and c++ both are same or different
@saketkumar3879
@saketkumar3879 6 жыл бұрын
array will go form i=4 till i>=position not i
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi saket thanks for your correction and you are correct it is i>=position and i am sorry for my mistake. thanks for observation and correcting my mistake.
@shriramshankardash7846
@shriramshankardash7846 3 жыл бұрын
In second for loop two mistake is there one is in the place of = and in the place of pos it should be pos-1 ...
@htetwayyanpaing
@htetwayyanpaing 6 жыл бұрын
how to insert two or three element in array sir.Please explain if you have time
@muneerpuri5705
@muneerpuri5705 5 жыл бұрын
Use a do while loop condition.. and insert as many time you want
@ziad-cp4ci
@ziad-cp4ci 4 жыл бұрын
Can I insert the new element in the end of the array instead of adding it in the middle?
@user-ls8ij1bz1l
@user-ls8ij1bz1l 6 ай бұрын
Yes you can then enter the last position
@siminam.michile4648
@siminam.michile4648 3 жыл бұрын
Thankssss!!
@sudeeptech1393
@sudeeptech1393 6 жыл бұрын
sir I have one doubt after insert element size will increase is it possible to increase size of an array after insertion
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi sudeep yes the size of array can be increased as it is the major limitation of arrays. there is no restriction on boundaries of arrays.
@bhuvanalakshmibalachandar2383
@bhuvanalakshmibalachandar2383 5 жыл бұрын
Inserting element in a sorted array using python code is needed sir
@nageswarrao2848
@nageswarrao2848 4 жыл бұрын
Sir not coming sir output . something is wrong in this program perhaps of positions
@Jk47Nightrider
@Jk47Nightrider 3 жыл бұрын
❤️❤️
@mistryrashmiben4990
@mistryrashmiben4990 6 жыл бұрын
nice sir
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi Thanks for watching my sessions and your interest towards our channel.
@hdhhd7414
@hdhhd7414 5 жыл бұрын
Sir I think u should make some short video
@marketingworld6644
@marketingworld6644 4 жыл бұрын
Sir I have done exactly same as shown in your program but while executing it is showing output as 6422284.sor please help
@Somnath_Mistry
@Somnath_Mistry 4 жыл бұрын
RUN THIS PROGRAM IT'S THE SAME WITH MORE ACCURATE RESULT ;) #include #include int main() { int arr[10], i, pos, value, n; clrscr(); printf("Enter the size of the array: "); scanf("%d",&n); printf("Enter %d elements of the array: ",n); for(i=0;i=pos-1;i--) { arr[i+1]=arr[i]; } arr[pos-1]=value; for(i=0;i
@lokeshshamwani7520
@lokeshshamwani7520 3 жыл бұрын
@@Somnath_Mistry Thanks Dear.
@rohithprasad8423
@rohithprasad8423 4 жыл бұрын
Sir we want digital assistant all model papers explanation please
@nurmohammed8401
@nurmohammed8401 4 жыл бұрын
write program to read the array a[3][3] ,b[3][3] and c[3][3] then create the array z[9][3] so that they are array a at first and the array b in the middle and c in the end
@rajeshbainaboina7950
@rajeshbainaboina7950 4 жыл бұрын
Sir elements of an array antee manam evalee kadha sir elements
@Bittu012345
@Bittu012345 6 жыл бұрын
I think it should be For(i=4;i
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi srikanth i think i am correct as we have to insert the element in desired position so we have to move all the elements from end to position-1 and in for loop i mentioned as i
@softroniicscalicut7099
@softroniicscalicut7099 5 жыл бұрын
hi sr pls tell me detail with full program about inserting an array to another array comopletely
@sallehden2771
@sallehden2771 6 жыл бұрын
do you have video for 3. Sorting and 4. Searching?
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi salleh Bubble Sort kzbin.info/www/bejne/hGSYl6lnjqaSaJY Insertion Sort kzbin.info/www/bejne/n4fGe3-DlMeBi5I Selection Sort kzbin.info/www/bejne/rYmpipZ9iaqIasU Linear Search kzbin.info/www/bejne/fqXYk4Fnpr9nhZI Binary Search kzbin.info/www/bejne/b4LSZpaMj8eAnq8
@ruchikamengade7448
@ruchikamengade7448 5 жыл бұрын
Addition of two sparse matrix or transpose of matrix ka dalo sir
@chintunalluri6589
@chintunalluri6589 3 жыл бұрын
Sir motham ds full course telugulo explain cheyandi sir
@jaganmohini3642
@jaganmohini3642 5 жыл бұрын
Why to us decrement here?
@indianlordsmobile8082
@indianlordsmobile8082 3 жыл бұрын
sir yeh program joh aapnai likha tha usko maine run karkai dekha toh error aah rha tha
@sandhyasamdhya
@sandhyasamdhya 4 жыл бұрын
Output Shi nhi deta h sir
@rajeshkumar-gf1we
@rajeshkumar-gf1we 3 жыл бұрын
iam getting error(arrayindexoutofbondsexp), its not working in the java can anyone help me
@elizabeths6391
@elizabeths6391 6 жыл бұрын
no clarity in this video means not a program explaination the video clarity
@varunkabra2041
@varunkabra2041 6 жыл бұрын
Sir i tried the code taking size as n on turbo c++ but i am not able to get the output. pls help! Thanks
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
hi varun send me the code so that i will check and msg you
@varunkabra2041
@varunkabra2041 6 жыл бұрын
sir should i send it here?
@sundeepsaradhi
@sundeepsaradhi 6 жыл бұрын
yes send here so that i will clarify the doubt
@varunkabra2041
@varunkabra2041 6 жыл бұрын
sir its the same code which was there in the video, except i replaced it with n as you told in the ending of the video
@amitjain1686
@amitjain1686 5 жыл бұрын
Sir insert more than one value at a time...
@rajendrasashamal3454
@rajendrasashamal3454 5 жыл бұрын
Sir one question arise from this program
@blacksparrow4635
@blacksparrow4635 2 жыл бұрын
if anyone notice its wrong; when i+1 =i ,, in next iteration you had lose value of (i+1) .....for this method you need to shift from right most value
37 - DELETION OF AN ELEMENT FROM A SPECIFIC POSITION IN AN ARRAY - C PROGRAMMING
15:15
1.2 Array Operations - Traversal, Insertion | Explanation with C Program | DSA Course
28:51
❌Разве такое возможно? #story
01:00
Кэри Найс
Рет қаралды 7 МЛН
Alat yang Membersihkan Kaki dalam Hitungan Detik 🦶🫧
00:24
Poly Holy Yow Indonesia
Рет қаралды 11 МЛН
Inserting an element in an array (C program)
7:16
CSE GURUS
Рет қаралды 87 М.
40 - BUBBLE SORT WITH EXAMPLE
24:47
Sundeep Saradhi Kanthety
Рет қаралды 353 М.
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 843 М.
54 - FUNCTIONS - C PROGRAMMING
37:03
Sundeep Saradhi Kanthety
Рет қаралды 361 М.
Insert Element into Array  | Logical Programming in C | Naresh IT
7:06
Naresh i Technologies
Рет қаралды 95 М.
How To Think Like A Programmer
1:00:07
Coding Tech
Рет қаралды 2 МЛН
33 - ONE DIMENSIONAL ARRAYS DECLARATION, INITIALIZATION AND ACCESSING - C PROGRAMMING
41:34
Deleting an element in an array (C program)
5:14
CSE GURUS
Рет қаралды 61 М.