selection sort using java
Loading...
6,937
Loading...
Uploader Comments (chandubabacoder)
see all
All Comments (5)
-
where the fuck is the sound man! how are we supposed to learn from this!
Loading...
Great vid !
Would there be any difference if I were to change the following line in the selection sort
for(int i = 0 ; i < a.length ; i++)
instead of
i < a.length - 1;
beyonnn 2 years ago 2
thank u!
See the inner loop... its starting from i+1. So if number of numbers is suppose 10 (0 to 9), it would check for numbers in index i=8 to j=9. But if you write that loop you pointed out then it would check for i=9 and j=10.. but that wont happen cause j<10 in the condition of second loop.
It wont make any difference but it won't be efficient. I might not be clear. If any problem please ask again :)
chandubabacoder 2 years ago