Talk:Quickselect

message: The current partitioning implementation uses a weird trick of starting the pivot index from lo - 1, which is problematic if lo is not a signed integer variable (e.g., unsigned in C++ IMHO can cause UB, though would work probably on all modern architectures). Anyways, this version of the algorithm is kind of a head scratcher. Why don't we use a simpler version, which is presented on the (Quick select page?). Thank you! Srchvrs (talk) 12:13, 20 June 2022 (UTC)
thread_title:  Weird (and subtly incorrect) pseudo-code for Lomuto partitioning scheme? 

message: As far as I am aware, the algorithm as presented is incorrect, specifically the recursive case:
     else if n < pivotIndex
         return select(list, left, pivotIndex - 1, n)
     else
         return select(list, pivotIndex + 1, right, n)
If we n > pivotIndex, then we only need to search for the (n - pivotIndex) element in the right-hand side. A quick look at some other implementations online (e.g., here) back this up.
--Nels Beckman (talk) 10:25, 27 January 2015 (UTC)
replies: text: Replacing n by n-pivotindex is appropriate for versions of the algorithm that pass in the whole array recursively, because when we do that the position of the element we're looking for is offset by the number of elements earlier than it that are omitted from the recursive call. But in this version, we pass in the left and right bounds of a subarray, and the position of the element we're looking for does not change. So it is correct, and changing n would be a mistake. Try running a few hand simulations and see for yourself! —David Eppstein (talk) 17:24, 27 January 2015 (UTC)
replies: text: Interesting. Took me several minutes two realize the algorithm. I want to add that replacing n by n-pivotindex is also appropriate for version of the algorithm that only pass parts of the array recursively. E.g. passing the part, which contains all elements of the array, which are smaller/greater or equal than some pivot.--77.3.0.85 (talk) 17:17, 11 April 2015 (UTC)
thread_title:  Is recursion correct? 

message: Some overlap with this and selection algorithm, in particular the section describing this algorithm. Merge out? Dcoetzee 00:04, 18 August 2007 (UTC)
thread_title:  Overlap with [[selection algorithm]] 

message: A common and natural variant of this algorithm returns a range of values, usually in sorted order. E.g. qselect ([5,2,3,9,0,1,5], 1, 4) would return [1,2,3]. This runs in O(n) + O(k log k).  — Preceding unsigned comment added by 188.126.200.132 (talk) 06:32, 13 August 2014 (UTC)
thread_title:  Returning a range 

message: Hello fellow Wikipedians,
I have just modified one external link on Quickselect. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
*Added archive https://web.archive.org/web/20140109200842/http://11011110.livejournal.com/119720.html to http://11011110.livejournal.com/119720.html
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
Cheers.—InternetArchiveBot (Report bug) 20:55, 5 April 2017 (UTC)
thread_title:  External links modified