Remove Duplicates from sorted Array. Remove multiple occurrences of an element from array. Keep only one occurrence of each element. No multiple copies. Write a program to do this.
Жүктеу.....
Пікірлер: 198
@muthushankar5703 жыл бұрын
I was searched this problem in many websites not get this problem..but i see this problem in ur channel to understand very easily and learn clearly... Thank u brother 🙏
@madhukumar12386 жыл бұрын
Thank you!!! very well explained!! wish we had a professor like you!!!
@sinebiinnazo78822 жыл бұрын
I love how made the solution looked very simple. I wish you can treat more basic Java Algorithms so that i can understand several approaches to solving algorithms.
@nandiniprakash51916 жыл бұрын
Very much helpful and can understand by anyone as explanation is very simple . Expecting to see the videos for java collections problems.
@Ihabkhattab4 жыл бұрын
Thank you bro for your visualization of the problem and the solution is awesome. finally, I got it 🙏🏿
@azad13004 жыл бұрын
Your way of teaching is awesome. we need more problems solution on array, so update with some more problems.
@tanujvishwakarma1967 Жыл бұрын
wow i watched so many video but no buddy explained to butter and not cover to all every concept but u clear all the concept all and i"m surprise i means wow ; I"m say to thank u to u " sat sat naman app ko Hindi me bole to "
@tapanjeetroy82665 жыл бұрын
Thanks for uploading it.. You are doing a great great job.. Please please upload more of such programming questions.. We really need it
@jayashreeanitha44383 жыл бұрын
Nice explanation sir .. well done .. Thank u so much for crystal clear explanation👍
@FlavortownFreddy Жыл бұрын
Very well explained, even small details are touched that others missed
@aayushsarna60175 жыл бұрын
Hi Vivek, What is the total time complexity for both the solutions. I believe that initially sorting the array will also take some time. So in this case can you please explain?
@SmartProgramming5 жыл бұрын
awesome explanation sir, hats off, keep uploading, thank you 👍👍👍👍🙂🙂🙂🙂
@ManishaKumari-yv3nf3 жыл бұрын
Your explanation technique is great 👍
@nitinfudani15526 жыл бұрын
Liked the way you explained! Really Helpful.
@PradeepSingh-ov3bt6 жыл бұрын
make these kinds of tricky questions which provide best solution for a particular problem
@abhishek_singh512 Жыл бұрын
Nice lecture sir keeping uploading this type of conceptual video 🥰🥰🥰🥰🙏🙏🙏🙏🙏🙏 Maja aa gaya 🙂
@mr.unique4974 Жыл бұрын
Thank you Sir for helping . I've been searching a lot for the logical explanation.
@jabraham10594 жыл бұрын
if we keep modifying the same array will the size of the array change?
@Devilsworld-d9l Жыл бұрын
We kept i
@satish0404 жыл бұрын
Hi Vivek, Can you do the same using hash tables. I am interested in known how to effectively create the hash function so that we dont have a large hashvalue. also how to avoid clash. Ex 0%20 is 0 and 20%20 is 0so using modulo is not that effective way of creating hash.
@bassantdiaaahmed57364 жыл бұрын
thank you so mush you are brilliant and you have such a beautiful method of teaching
@gurunatharudhbhandarkavath77814 жыл бұрын
sir If the duplicates are not in consecutive then what we have to do?
@avibm9484 жыл бұрын
Thanks for the video. Something is missing at the end for the "in memory" case , test [1,2,3,3] you need to add at the end while j
@anilnkhsatriya90474 жыл бұрын
Hi Vivek, pls explain, how to remove the eliments of linked list which is having sum is equals to zero
@mahideeptumati5 жыл бұрын
One doubt here. While using same array to avoid duplicates j ended up with 3 here , then what happened to elements present in index 4,5,6,7 of array arr as we didn’t remove them in that array
@gokulnathnallaiya7617
4 жыл бұрын
print array from 0 to j
@champion5946
2 жыл бұрын
@@gokulnathnallaiya7617 thanks buddy
@hariprasad1744 Жыл бұрын
In the first approach zeros will be added at the end of the temp array as we are creating with the same size of the actual array. and int he second approach you didnt explain how to remove the last elements. Can you please add the code for the above in your git
@vidhyapriyadharsinicoimbat43525 жыл бұрын
Awesome Explanation thank you sir
@Gaurav-bv6xr6 жыл бұрын
sir take all interview probelms from geeksforgeeks and dicuss their algorithm and complexity
@sahad_abd
2 жыл бұрын
Plz help me bro... I have to prepare for placements plz tell where should I refer
@Gaurav-bv6xr
2 жыл бұрын
@@sahad_abd bro,i am not preparing for interview now😅
@sahad_abd
2 жыл бұрын
@@Gaurav-bv6xr plz suggest me brooo..just you know
@Gaurav-bv6xr
2 жыл бұрын
@@sahad_abd prepare interview ques from geeksforgeeks
@GG-hk5iz5 жыл бұрын
Very Well Explained .Thanks a lot
@JadeMelody086 жыл бұрын
Great explanation. Thanks!
@Lucy-dh2wj4 жыл бұрын
Very clear and understandable! thanks!
@praveenpuri22083 жыл бұрын
what about 1,2,2,3,3,1,4,4.... can we apply this algo in situation?
@gawarivivek4 жыл бұрын
Thanks a lot, Sir!! Simplified explanation..:)
@laragarg6 жыл бұрын
Very helpful. Thank you very much.
@menkamenka6616 жыл бұрын
its really very helpful..Thanks
@ryanafzal41299 ай бұрын
Can anybody explain what is the time complexity of this algorithm?
@naboulsikhalid7763 Жыл бұрын
what a quality explanation!. big thanks for the effort
@lailasanthi75985 жыл бұрын
If last element and before element are equal what is the code sir
@xiangwingrace86726 жыл бұрын
Very Good! Please discuss more complicated problems from GeeksforGeeks.
@Kumarvivek-uv5hf3 жыл бұрын
the Solution does not work for constant space arr= [1,1,2] as J value remains 1 and hence when we want to print the array form 0 to j it will fail.
@jmba05224 жыл бұрын
Can i see the whole program of this please?
@joelonix53266 жыл бұрын
Good work.really helpful
@kavithagorantla60002 жыл бұрын
Sir output kuda print cheyyochu kadha sir
@amarjeetkurmi1302 Жыл бұрын
Very simple explanation sir
@prasadmotupalli76385 жыл бұрын
in first case the last element is 4 o/p becomes----1 2 3 4 4??
@karthikr21864 жыл бұрын
Pre and Post increment only using bitwise operator In c can u Post
@godwincharan6 жыл бұрын
The last line causes ambiguous behaviour if there is no element in the array. i.e. the size of the array is zero. Also using constant space method the final array will be 1,2,3,4,3,3,4,4 as we are using the same array and we don't clear the memory for those.
@therealsayanroy
6 жыл бұрын
it's for sorted array
@samiahmadkhan2865
6 жыл бұрын
You didn't get his point. He's right, you will need to remove the remaining elements from the array after Jth position
@mepsk
5 жыл бұрын
Exactly.. I have tried.. the last elements remain in array..
@tonmoyrakshit1717
5 жыл бұрын
That's right! We need to run a loop from jth+ 1 index till the last (n-1) and clear the remaining elements of the array.
@sairamgamidi7786
3 жыл бұрын
@@tonmoyrakshit1717 Can u give the code to clea remaining elements
@user-youyoki90545 жыл бұрын
I feel sorry to say, but I wasn't able to get the result as you explained on the video(even though I have written the code as yours).
@crodr001
4 жыл бұрын
There is an error in his explanation at least on the O(1). It should be a difference between the array his looping through AND a new array. He treating All as the same array.
@gavravdhongadi9824
3 жыл бұрын
You need to start the loop from I=0;I
@mamuntheman65432 жыл бұрын
if the arr is 1 2 3 1 2 3 then its not able to find the duplicate that you discussed in the every last moment.
@sunainagandra29246 жыл бұрын
thank you sir..please post more..we will be very thakfull sir
@sanjayd96753 жыл бұрын
#include void main(){ int n=8; int a[8]={1,2,2,3,3,3,4,4}; int j=0; for(int i=0 ; i if(a[i]!=a[i+1]){ a[j]=a[i]; j++; } } a[j]=a[n-1]; for(int i=0 ; i printf("%d" , a[i]); } } i think this works fine while printing we have to go till j+1 and not n when we do so we get the correct output but is there anyother method .
@harishdalmia65385 жыл бұрын
Hi Can you please share video on : Given a 2D plane with n points in it. Tell me the k closest points near to a given point.
@mohanrajg7254 Жыл бұрын
Vivekanand sir can i get java pgm for this ??
@caiomartins78075 жыл бұрын
Very good lesson !!
@krishnareddyyerram4615 Жыл бұрын
i++ j++ will not execute if duplicate found. Sort is required to place duplicate side by side.
@saadmanahmed8606 жыл бұрын
sir...in constant space method, u churn out output to be [ ]{ 1, 2 ,3 ,4}... but according to your expounded algorithm, output comes out to be [ ]{1,2,3,4, 3,3,4,4 } as deletion of redundant 3,3,4,4 never undergoes....plz explain???????????
@algorithmsguide5076
4 жыл бұрын
same doubt
@shalinsitwala
4 жыл бұрын
Since you know j=3, which means first 4 are distinct elements. So you can use your unique values in the array by for(int i = 0; i
@ranjithparuchuri73266 жыл бұрын
nicely explained.thanks
@RTX_valorant3 жыл бұрын
Why can't we use just list(set(arr))???
@shubhamathawale72962 жыл бұрын
Thank you sir 🙏 everything is clear now
@anchaldubey42175 жыл бұрын
Could you a make video on Chess Design
@deepak-lv4vn3 жыл бұрын
you are completely ossum sir!!
@94415718732 жыл бұрын
//Remove duplicates from Array let arr = [1,2,3,2,4,3,5]; let res = getResult(arr); function getResult(arr){ let obj = {}; let res = []; for(let i=0;i
@dandanamado87854 жыл бұрын
Thank you, I have a question sir what is the n-1 stands for inside the for loop? Thank you
@MrMarkgyuro
4 жыл бұрын
In this case we can not go to the last index. Because we can not compare it to the next index after it, that is a not existing index. We have to break out from the loop before we get to the last index. But we can handle the problem with transferring the last index's element to the new array. the basic method: the length of the array is represented by n. in this case n = 9, it means we have 9 elements. this helps us beacuse as you see indexes in the array are starting from 0 to n - 1. In our case, 0, 1, 2, 3, 4, 5, 6, 7, 8, note that 8 = 9 - 1 (n - 1). and this means that if we are the 8th iteration, we will go inside the if conditions body, but after the 8th (again, n - 1) we break from the loop.
@jitendarsahani11
4 жыл бұрын
Second last elements
@wmpah6 жыл бұрын
very clear and good writing on whiteboard
@indianinvestor13012 жыл бұрын
sir really good and help me a lot
@Vithal_Nivargi Жыл бұрын
Thank you well explained
@MAHESHAITBECS10 күн бұрын
good explanation sir
@santhuravikanti49885 жыл бұрын
but if we use same array after filling the elements into array ,still will get duplicates after the loop in above example after filling the elements the index j is point to 3 and elements are filtered ,but if we display the array will get all elements after index 3 also,is this expected behavior
@malia86932 жыл бұрын
great explanation!
@samiahmadkhan28656 жыл бұрын
You may want to slice of all the elements after j index, since you are doing in place replace.
@ganeshshetty8441
Жыл бұрын
correct, Even i have commented the same
@ramindersonu3 жыл бұрын
Very good explanation
@04.nehalsingh122 жыл бұрын
awesome tutorial sir
@helloyou42336 жыл бұрын
good quality education.
@ramakrishnareddy27025 жыл бұрын
please give me example code for your logic and i'm getting errors to your code
@Kidsgyan7625 жыл бұрын
Sir nice explanation
@manojnaidu6 жыл бұрын
what about the remaining elements in the original array after index 4?
@amirtim2007
6 жыл бұрын
you are right , he needs to go every after the last j, and in every place to put '/0' , or null . depend of the type of the array.
@therealsayanroy
6 жыл бұрын
print upto j.. no need to print after that
@MohdSameer-rx9gj3 жыл бұрын
Thank you very much sir...
@aokreddy9206 жыл бұрын
Nice explain sir
@nidhisingh78023 жыл бұрын
Sir also tell complexity in each case .
@shivanikumari31424 жыл бұрын
in the first method of using extra space,temp has to be intialized.How we will intialize
@rajeshdevan60515 жыл бұрын
Very nice Sir thank you
@janispaloma60605 жыл бұрын
What if the duplicate of 2 is place on the last place on array list
@durjaarai7737
4 жыл бұрын
Janis Paloma - hi, the question n solution is on sorted array.
@abhinandanmajumder8444 жыл бұрын
Sir, please tell how will u print the output as value of n decreases after removing duplicate
@jitendarsahani11
4 жыл бұрын
You have value of j.. you can use it to iterate throught new array.and print the elements
@bishalrajbhattarai5482
4 жыл бұрын
But that will be the contion j< upto what? To print the element
@RameshThota-ok6ct Жыл бұрын
it is applicable onely numbers are followed some order. it is not work dis order array
@khimleshgajuddhur68925 жыл бұрын
can you give me the code in vb please...?
@mohammad-karbalaee3 жыл бұрын
you are the loveliest indian ever.
@akhint4379 Жыл бұрын
Thank you so much sir❤
@ekramdayan38004 жыл бұрын
great video keep it up buddy
@thalabloods2514 Жыл бұрын
sir I tried it was awesome but getting array elements from user input is not working please upload video from getting user input and then remove duplicate
@yasmeenkarachiwala96124 жыл бұрын
Amazing!
@shahrukhshaikh95585 жыл бұрын
I think we have to add arr[j++] =arr[n-1] if last two elements of array are same in constant space method
@moodswingsoflife2 жыл бұрын
Thanks sir .. really helpful
@vivekanandkhyade
2 жыл бұрын
Thanks a lot
@TheMihirpatel234 жыл бұрын
Thank you so much sir
@zaheershaikh79826 жыл бұрын
Good explanation buddy, a just one quick question to you. What if the last value is 4 instead of 5 then?
@dev_manish
6 жыл бұрын
there is something wrong with this algo.... use arr[j++]=arr[i] and arr[j++]=arr[n-1]
@doviche
5 жыл бұрын
@@dev_manish, the algo is wrong!
@neelu52496 жыл бұрын
NYC explanation..but very slow process
@avi-09855 жыл бұрын
Sir but if all the elements are same this code will not work For example if array elements are:2 2 2 2 2
@ashwathbhat98
5 жыл бұрын
It will work. Nothing will be added during the for loop since the elements are same. But we add the last element outside the for loop which is 2 in your case. Hope you understood. If not, try using a pen and paper for each i.
@hanschaudry8082 жыл бұрын
shout out to you bro, I hope someone posted you on national boyfriend day
@nabilelassaad60865 жыл бұрын
where is the code ?
@kanimozhiparivallal9955 жыл бұрын
Super class....
@spiceto11886 жыл бұрын
Hi I really appreciated your video. But one question, what does n - 1 mean?
@therealsayanroy
6 жыл бұрын
Zohaib Shahzad n is total number of array elements if a[10] then n is 11 cause index of array starts from 0
Пікірлер: 198
I was searched this problem in many websites not get this problem..but i see this problem in ur channel to understand very easily and learn clearly... Thank u brother 🙏
Thank you!!! very well explained!! wish we had a professor like you!!!
I love how made the solution looked very simple. I wish you can treat more basic Java Algorithms so that i can understand several approaches to solving algorithms.
Very much helpful and can understand by anyone as explanation is very simple . Expecting to see the videos for java collections problems.
Thank you bro for your visualization of the problem and the solution is awesome. finally, I got it 🙏🏿
Your way of teaching is awesome. we need more problems solution on array, so update with some more problems.
wow i watched so many video but no buddy explained to butter and not cover to all every concept but u clear all the concept all and i"m surprise i means wow ; I"m say to thank u to u " sat sat naman app ko Hindi me bole to "
Thanks for uploading it.. You are doing a great great job.. Please please upload more of such programming questions.. We really need it
Nice explanation sir .. well done .. Thank u so much for crystal clear explanation👍
Very well explained, even small details are touched that others missed
Hi Vivek, What is the total time complexity for both the solutions. I believe that initially sorting the array will also take some time. So in this case can you please explain?
awesome explanation sir, hats off, keep uploading, thank you 👍👍👍👍🙂🙂🙂🙂
Your explanation technique is great 👍
Liked the way you explained! Really Helpful.
make these kinds of tricky questions which provide best solution for a particular problem
Nice lecture sir keeping uploading this type of conceptual video 🥰🥰🥰🥰🙏🙏🙏🙏🙏🙏 Maja aa gaya 🙂
Thank you Sir for helping . I've been searching a lot for the logical explanation.
if we keep modifying the same array will the size of the array change?
We kept i
Hi Vivek, Can you do the same using hash tables. I am interested in known how to effectively create the hash function so that we dont have a large hashvalue. also how to avoid clash. Ex 0%20 is 0 and 20%20 is 0so using modulo is not that effective way of creating hash.
thank you so mush you are brilliant and you have such a beautiful method of teaching
sir If the duplicates are not in consecutive then what we have to do?
Thanks for the video. Something is missing at the end for the "in memory" case , test [1,2,3,3] you need to add at the end while j
Hi Vivek, pls explain, how to remove the eliments of linked list which is having sum is equals to zero
One doubt here. While using same array to avoid duplicates j ended up with 3 here , then what happened to elements present in index 4,5,6,7 of array arr as we didn’t remove them in that array
@gokulnathnallaiya7617
4 жыл бұрын
print array from 0 to j
@champion5946
2 жыл бұрын
@@gokulnathnallaiya7617 thanks buddy
In the first approach zeros will be added at the end of the temp array as we are creating with the same size of the actual array. and int he second approach you didnt explain how to remove the last elements. Can you please add the code for the above in your git
Awesome Explanation thank you sir
sir take all interview probelms from geeksforgeeks and dicuss their algorithm and complexity
@sahad_abd
2 жыл бұрын
Plz help me bro... I have to prepare for placements plz tell where should I refer
@Gaurav-bv6xr
2 жыл бұрын
@@sahad_abd bro,i am not preparing for interview now😅
@sahad_abd
2 жыл бұрын
@@Gaurav-bv6xr plz suggest me brooo..just you know
@Gaurav-bv6xr
2 жыл бұрын
@@sahad_abd prepare interview ques from geeksforgeeks
Very Well Explained .Thanks a lot
Great explanation. Thanks!
Very clear and understandable! thanks!
what about 1,2,2,3,3,1,4,4.... can we apply this algo in situation?
Thanks a lot, Sir!! Simplified explanation..:)
Very helpful. Thank you very much.
its really very helpful..Thanks
Can anybody explain what is the time complexity of this algorithm?
what a quality explanation!. big thanks for the effort
If last element and before element are equal what is the code sir
Very Good! Please discuss more complicated problems from GeeksforGeeks.
the Solution does not work for constant space arr= [1,1,2] as J value remains 1 and hence when we want to print the array form 0 to j it will fail.
Can i see the whole program of this please?
Good work.really helpful
Sir output kuda print cheyyochu kadha sir
Very simple explanation sir
in first case the last element is 4 o/p becomes----1 2 3 4 4??
Pre and Post increment only using bitwise operator In c can u Post
The last line causes ambiguous behaviour if there is no element in the array. i.e. the size of the array is zero. Also using constant space method the final array will be 1,2,3,4,3,3,4,4 as we are using the same array and we don't clear the memory for those.
@therealsayanroy
6 жыл бұрын
it's for sorted array
@samiahmadkhan2865
6 жыл бұрын
You didn't get his point. He's right, you will need to remove the remaining elements from the array after Jth position
@mepsk
5 жыл бұрын
Exactly.. I have tried.. the last elements remain in array..
@tonmoyrakshit1717
5 жыл бұрын
That's right! We need to run a loop from jth+ 1 index till the last (n-1) and clear the remaining elements of the array.
@sairamgamidi7786
3 жыл бұрын
@@tonmoyrakshit1717 Can u give the code to clea remaining elements
I feel sorry to say, but I wasn't able to get the result as you explained on the video(even though I have written the code as yours).
@crodr001
4 жыл бұрын
There is an error in his explanation at least on the O(1). It should be a difference between the array his looping through AND a new array. He treating All as the same array.
@gavravdhongadi9824
3 жыл бұрын
You need to start the loop from I=0;I
if the arr is 1 2 3 1 2 3 then its not able to find the duplicate that you discussed in the every last moment.
thank you sir..please post more..we will be very thakfull sir
#include void main(){ int n=8; int a[8]={1,2,2,3,3,3,4,4}; int j=0; for(int i=0 ; i if(a[i]!=a[i+1]){ a[j]=a[i]; j++; } } a[j]=a[n-1]; for(int i=0 ; i printf("%d" , a[i]); } } i think this works fine while printing we have to go till j+1 and not n when we do so we get the correct output but is there anyother method .
Hi Can you please share video on : Given a 2D plane with n points in it. Tell me the k closest points near to a given point.
Vivekanand sir can i get java pgm for this ??
Very good lesson !!
i++ j++ will not execute if duplicate found. Sort is required to place duplicate side by side.
sir...in constant space method, u churn out output to be [ ]{ 1, 2 ,3 ,4}... but according to your expounded algorithm, output comes out to be [ ]{1,2,3,4, 3,3,4,4 } as deletion of redundant 3,3,4,4 never undergoes....plz explain???????????
@algorithmsguide5076
4 жыл бұрын
same doubt
@shalinsitwala
4 жыл бұрын
Since you know j=3, which means first 4 are distinct elements. So you can use your unique values in the array by for(int i = 0; i
nicely explained.thanks
Why can't we use just list(set(arr))???
Thank you sir 🙏 everything is clear now
Could you a make video on Chess Design
you are completely ossum sir!!
//Remove duplicates from Array let arr = [1,2,3,2,4,3,5]; let res = getResult(arr); function getResult(arr){ let obj = {}; let res = []; for(let i=0;i
Thank you, I have a question sir what is the n-1 stands for inside the for loop? Thank you
@MrMarkgyuro
4 жыл бұрын
In this case we can not go to the last index. Because we can not compare it to the next index after it, that is a not existing index. We have to break out from the loop before we get to the last index. But we can handle the problem with transferring the last index's element to the new array. the basic method: the length of the array is represented by n. in this case n = 9, it means we have 9 elements. this helps us beacuse as you see indexes in the array are starting from 0 to n - 1. In our case, 0, 1, 2, 3, 4, 5, 6, 7, 8, note that 8 = 9 - 1 (n - 1). and this means that if we are the 8th iteration, we will go inside the if conditions body, but after the 8th (again, n - 1) we break from the loop.
@jitendarsahani11
4 жыл бұрын
Second last elements
very clear and good writing on whiteboard
sir really good and help me a lot
Thank you well explained
good explanation sir
but if we use same array after filling the elements into array ,still will get duplicates after the loop in above example after filling the elements the index j is point to 3 and elements are filtered ,but if we display the array will get all elements after index 3 also,is this expected behavior
great explanation!
You may want to slice of all the elements after j index, since you are doing in place replace.
@ganeshshetty8441
Жыл бұрын
correct, Even i have commented the same
Very good explanation
awesome tutorial sir
good quality education.
please give me example code for your logic and i'm getting errors to your code
Sir nice explanation
what about the remaining elements in the original array after index 4?
@amirtim2007
6 жыл бұрын
you are right , he needs to go every after the last j, and in every place to put '/0' , or null . depend of the type of the array.
@therealsayanroy
6 жыл бұрын
print upto j.. no need to print after that
Thank you very much sir...
Nice explain sir
Sir also tell complexity in each case .
in the first method of using extra space,temp has to be intialized.How we will intialize
Very nice Sir thank you
What if the duplicate of 2 is place on the last place on array list
@durjaarai7737
4 жыл бұрын
Janis Paloma - hi, the question n solution is on sorted array.
Sir, please tell how will u print the output as value of n decreases after removing duplicate
@jitendarsahani11
4 жыл бұрын
You have value of j.. you can use it to iterate throught new array.and print the elements
@bishalrajbhattarai5482
4 жыл бұрын
But that will be the contion j< upto what? To print the element
it is applicable onely numbers are followed some order. it is not work dis order array
can you give me the code in vb please...?
you are the loveliest indian ever.
Thank you so much sir❤
great video keep it up buddy
sir I tried it was awesome but getting array elements from user input is not working please upload video from getting user input and then remove duplicate
Amazing!
I think we have to add arr[j++] =arr[n-1] if last two elements of array are same in constant space method
Thanks sir .. really helpful
@vivekanandkhyade
2 жыл бұрын
Thanks a lot
Thank you so much sir
Good explanation buddy, a just one quick question to you. What if the last value is 4 instead of 5 then?
@dev_manish
6 жыл бұрын
there is something wrong with this algo.... use arr[j++]=arr[i] and arr[j++]=arr[n-1]
@doviche
5 жыл бұрын
@@dev_manish, the algo is wrong!
NYC explanation..but very slow process
Sir but if all the elements are same this code will not work For example if array elements are:2 2 2 2 2
@ashwathbhat98
5 жыл бұрын
It will work. Nothing will be added during the for loop since the elements are same. But we add the last element outside the for loop which is 2 in your case. Hope you understood. If not, try using a pen and paper for each i.
shout out to you bro, I hope someone posted you on national boyfriend day
where is the code ?
Super class....
Hi I really appreciated your video. But one question, what does n - 1 mean?
@therealsayanroy
6 жыл бұрын
Zohaib Shahzad n is total number of array elements if a[10] then n is 11 cause index of array starts from 0
@Lionelandresluis
5 жыл бұрын
-1 the length of the array
@Hamlaww
5 жыл бұрын
Can someone show how can we print the temp[j]...