Thank you, this was straightforward and easy to understand
@CodingSimplified3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@jitendraraghuwanshi13654 жыл бұрын
explained very well 👍🏼 keep up the good work
@CodingSimplified4 жыл бұрын
Glad you liked it. Keep Watching.
@veeresh44412 жыл бұрын
We can directly replace the values with ind+1 (or ind + x) right? No need to even have checks, what's the use of cycle sort?
@sohailbasha77812 жыл бұрын
Yes, but i think the logic is helpful in solving dsa
@reekrev2 жыл бұрын
I have two doubts here: 1. The time complexity is O(n^2), not O(n); can you see why? 2. This is not actually sorting. If you know beforehand the desired result is the ordered list of numbers from k…n you can just generate that list in O(n) time: for(int i=k;i
@yashnarang30142 ай бұрын
cry about it baby
@KK7155.3 жыл бұрын
Thank you so much. Very nicely explained 👍
@CodingSimplified3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@pranays65032 жыл бұрын
great explanation broo :)
@CodingSimplified2 жыл бұрын
Thanks for your nice feedback. Keep Watching :)
@prasanthkumar6393 Жыл бұрын
This video defines the channel name❤
@nikhilgoyal83403 жыл бұрын
The time complexity mentioned in the description is not correct.
@AmitKumar-rr5jx3 жыл бұрын
Time complexity is correct for the above case. That is if elements are not greater than n. So one can say, this is a special case. But the complexity of cyclic sort is 0(n ^ 2) and the algorithm will be quite different for finding the correct position.
@AnushaPoosala Жыл бұрын
Sir,, Your way of teaching is Amazing. Please add source code.
@Randomizer02 Жыл бұрын
What if duplicate values exist?
@free-palestine0002 жыл бұрын
best channel
@CodingSimplified2 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@PankajGupta-gh9cm4 жыл бұрын
what if array contains duplicates
@ayushraj29284 жыл бұрын
//Scan vector/array A(n) //Now cycle logic for (int i = 0; i < n; i++) { int pos = A[i] - 1; if (A[pos] != A[i]) { swap(A[pos], A[i]); i--; } } //Print elements It will put the numbers in array in correct indexes..and the other indexes whose values are not in array will get any other repeated value Like for INPUT : 5 3 3 1 2 2 OUTPUT : 1 2 3 3 5 2
@as_if2 жыл бұрын
Now this is what you call beautiful
@yogendrapratapsingh76184 жыл бұрын
Cycle sort is also for non continuous elements
@TheSimpleEngineer4 жыл бұрын
This is cyclic sort, not cycle sort. There is a difference.
@cwash084 жыл бұрын
@@TheSimpleEngineer thanks for the tip
@viharivemuri72027 ай бұрын
What a silly video? You need to do all that to just sort numbers from 1 to n? Why can'y you just do for each index i, arr[i] = i+1?