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

  • Home
  • SEARCH
  • 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 8014691
In Process

The Archive Base Latest Questions

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

Quickselect, based on quicksort, and counting select, based on counting sort. Each is capable

  • 0

Quickselect, based on quicksort, and counting select, based on counting sort.

Each is capable of finding the kth smallest element in an unsorted/sorted list/array.

However, I wish to write a set of guidelines to decide which of the two algorithms is most appropriate for specific situations. I need to think of situations, and than implement guidelines as to which algorithm is the better choice.

For this, I need a little help distinguishing which algorithm has specific strengths in certain areas, etc.

  • 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:01:11+00:00Added an answer on June 4, 2026 at 8:01 pm

    (1) Count sort requires the elements to be enumerable (There is a unique mapping of elements into integers) in order to work properly. Quick sort on the other hand, only require a well define compare op between every two elements (The compare function should be transitive – or intuitively – not self-contradicting).

    This is one main issue you should face – the counting selection cannot always be used, while quick selection can.

    Why? Well, have a look at how count sort works, or specifically – how it determines the ordering between distinct element a and distinct element b: It uses its integer value to count how elements of this kind are in the collection. Have a look at the pseudo-code in the wikipeida article. What I am refering to can be seen in this lines:

    for each input item x:
        Count[key(x)] = Count[key(x)] + 1
    

    The key(x) value, is the enumeration of the elements – if it does not exist, what will key(x) yield? and how will the algorithm work?

    This also applies for the count select algorithm for the same reasons, it also uses the key(element) in order to count how much times this element repeats in the collection.

    (2) One more issue is efficiency if the range of elements is huge – where counting is inefficient, since it is linear in the range of elements.

    QuickSelect, based on quicksort run time is linear on average, but may sometimes decay to quadric time complexity.

    (3) Another issue is space – count selection requires additional space, linear in the range of the elements, while quick-selection does not.

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

Sidebar

Related Questions

According to Wikipedia , partition-based selection algorithms such as quickselect have runtime of O(n)
I've been poring over various tutorials and articles that discuss quicksort and quickselect, however,
I've been given the basic code for an algorithm, which selects the kth smallest
Wikipedia states that the average runtime of quickselect algorithm ( Link ) is O(n).
I use a jQuery function similar to the one in this thread: Easy way
I'm developing an application that's tracing lines of highways on the Google Maps SDK
Updated , original question below the line: I need to compute a median, and
Assume I have a database table with many names. I'd like to flex match
I have two tables: Product ------------------------------------ id group_id name quick_select ------------------------------------ 1 1 product1
I am writing this game with hundreds of levels, but in one of my

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.