Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Symbolic Butt posted:

the scratching sounds always bother me in these videos, gently caress. and those animations are a little bit too much

but what matters: I guess that they're the "same" in the sense that insertion sort is just a better tweaked version of selection sort. maybe something to do with dynamic programming? I'm surprised that I never heard about this before but then again I didn't do a BS CS

selection sort basically does the exact same thing every time. it always does θ(N^2) comparisons, which is bad, but also always does O(N) writes to the array, which is good

insertion sort is sensitive to the input. it can do O(N^2) comparisons and O(N^2) writes to the array in the worst case, which is bad, but if the array is close to sorted already then it does O(N) comparisons and O(N) writes and has fantastic locality, which is all very good

thanks for taking my post, i'll hang up and listen

Adbot
ADBOT LOVES YOU

  • Locked thread