We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Agreed! The average-case solution for QuickSelect is indeed O(n). Unfortunately, when the list is sorted (or "nearly" sorted), your algorithm will degenerate to the worst-case of O(n*n)... :(
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Luck Balance
You are viewing a single comment's thread. Return to all comments →
Agreed! The average-case solution for QuickSelect is indeed O(n). Unfortunately, when the list is sorted (or "nearly" sorted), your algorithm will degenerate to the worst-case of O(n*n)... :(