Added: 2 years ago
From: lcc0612
Views: 13,715
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (24)

Sign In or Sign Up now to post a comment!
  • Great videos... I've been practicing the implementation of algorithms with Java 6/7 and here's my implementation based on your explanation, Wikipedia, etc...

    h t t p : // code.google.com/p/programming-­artifacts/source/browse/trunk/­workspaces/hacking/data-struct­ures-impl/src/com/google/code/­datastrut/sort/algorithm/Selec­tionSortStrategy.java

    Chears!

  • This is wrong. There isn't a second array. The array elements are just being swaped.

  • @pithikoulis

    Hello, thanks for your comment. Your suggestion works too, and is in fact a more elegant approach to selection sort. However, i chose the method as demonstrated since it's much more intuitive, and becomes easier to understand.

    There is no strict rule defining how to implement a sorting algorithm, as long as the concept, in this case the idea of selection, is there.

  • @lcc0612

    Sorry, but thats just wrong. The main advantage ist that selection sort is an "inplace" sort algorithm, that does not need extra space.

  • @mongobot

    I did a bit of reading up, and turns out you're right. The in-place property was actually part of Selection sort's definition, I actually thought it was merely an implementation choice. I'll probably make a video this weekend as an addon to this video.

  • did you know, I'm a velociraptor and I know the fastest sorting algorithm, but I will not show it until I find someone that matches my speed...

    the name of my algorithm is velocirapsort, get it :P

  • [ lcc0612 ] .. simply, You Are The BEST Of All !

  • @dreamerr17

    Thank you very much!

  • Thanks .. I like it

  • @aboaziz1

    Thanks for your kind comment! I'm glad I could be of help!

  • wow... this helped a lot THANKSS

  • @dbzkidkev2

    Cheers! Glad I could be of help!

  • you explain good these sort algorithms, you could make also other videos with radix sort and so on.

  • @PUTSAS

    Thanks! I'm not very good with many sorting algorithms (in fact, most of these are self-studied), so I don't really dare to go into those I'm not so sure about!

  • Another good tutorial. My only question is I never really got the n-2 or n-1 stuff at the end. Is that essentially saying n-2 (so second from the end?) as a way of classifying the distance to the end for the use in the example?

  • @frampo4

    You're thinking in the right direction, though you made a mistake. I'll explain:

    By saying "there are n items in the list", we can infer that the last item in the list is also the "nth item" - So if there are 7 items in the list, then the last item would be the 7th item.

    So the "n-1"-th item in a list would be the second last item (not n-2, as you incorrectly said). In a list of 7 items, isn't the (n-1 = 7-1)th item, in other words the 6th item, the second last item?

  • You basically get the idea, I hope - The nth item is the last, the (n-1)th is the second last, and so on.

  • @lcc0612 Ah ok thanks :)

  • Thanks for uploadding..it really helped

  • @aabrification

    Cheers! I'm glad I could be a help!

  • quite useful,,thax :)

  • @BeYn11160

    Glad it was a help!

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more