walkccc / CLRS

📚 Solutions to Introduction to Algorithms Third Edition
https://walkccc.me/CLRS
MIT License
4.72k stars 1.26k forks source link

Problem 10.2 #309

Open rualark opened 4 years ago

rualark commented 4 years ago

B. When extracting minimal element, there is no need to find second smallest element. Just move last element of list to the beginning of the list.

Even if you want to find second smallest element, linear scan is not needed: it is either the second or the third element of the list.