Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8017607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:53:41+00:00 2026-06-04T20:53:41+00:00

I’ve had some good breakthroughs understanding some of the more advanced algorithms for sorting,

  • 0

I’ve had some good breakthroughs understanding some of the more advanced algorithms for sorting, selecting, searching etc.

Here’s the scenario I’m stuck on however.

With an array of values, in which you want to find the kth smallest element, you can use use quickselect if it’s unsorted, and a binary search if it is sorted.

If I understand correctly, via a pivot/partition system, quickselect will search an unsorted data set by choosing a pivot, creating groups of lows and highs by comparing each element to the pivot, and then recursively breaking down the lists into sublists via a changing pivot.

This sounds very similiar to how a binary search works, so why is it that quickselect works on unsorted values and binary search doesn’t, and doesn’t all the comparing in a quickselect algorithm (to work out the lows and highs) take a lot of … cost?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:53:42+00:00Added an answer on June 4, 2026 at 8:53 pm

    Binary search does NOT determine the k-th smallest element: it’s NOT a selection algorithm. Binary search determines if a value you supply as input is in the array or not.

    A selection algorithm determines the k-th smallest element. If the array is already sorted, as in the case of binary search, then selecting the k-th smallest element can be done in O(1), simply using k as an index into the array.

    To recap: with quickselect you can determine for instance the 8-th smallest element in the array, while with binary search you can search if an element with value 15 is in the array or not.

    Quickselect can select an arbitrary order statistics in expected O(n) time; binary search can search for an element in O(log n) time but requires the array to be sorted, otherwise the algorithm will not be correct. As I told you, selecting the k-th smallest element in a sorted array is trivial, requiring O(1) time to access the k-th element in the sorted array.

    Finally, searching for an element (a given value) when the array is not sorted requires in the worst case O(n) time since you need to perform a linear scan of the array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have some data like this: 1 2 3 4 5 9 2 6
I used javascript for loading a picture on my website depending on which small
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.