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 74437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:21:29+00:00 2026-05-10T20:21:29+00:00

I believe there’s a way to find the kth largest element in an unsorted

  • 0

I believe there’s a way to find the kth largest element in an unsorted array of length n in O(n). Or perhaps it’s ‘expected’ O(n) or something. How can we do this?

  • 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. 2026-05-10T20:21:30+00:00Added an answer on May 10, 2026 at 8:21 pm

    This is called finding the k-th order statistic. There’s a very simple randomized algorithm (called quickselect) taking O(n) average time, O(n^2) worst case time, and a pretty complicated non-randomized algorithm (called introselect) taking O(n) worst case time. There’s some info on Wikipedia, but it’s not very good.

    Everything you need is in these powerpoint slides. Just to extract the basic algorithm of the O(n) worst-case algorithm (introselect):

    Select(A,n,i):     Divide input into ⌈n/5⌉ groups of size 5.      /* Partition on median-of-medians */     medians = array of each group’s median.     pivot = Select(medians, ⌈n/5⌉, ⌈n/10⌉)     Left Array L and Right Array G = partition(A, pivot)      /* Find ith element in L, pivot, or G */     k = |L| + 1     If i = k, return pivot     If i < k, return Select(L, k-1, i)     If i > k, return Select(G, n-k, i-k) 

    It’s also very nicely detailed in the Introduction to Algorithms book by Cormen et al.

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

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 78k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Do you mean two lines as in one per x… May 11, 2026 at 3:38 pm
  • added an answer Java 5 is almost completely backwards compatible with Java 4.… May 11, 2026 at 3:38 pm
  • added an answer Absolutely, there is no need to expose a setter for… May 11, 2026 at 3:38 pm

Related Questions

I believe there's a way to find the kth largest element in an unsorted
I believe there is a way to do this, but I'm not familiar with
In the early days of .NET, I believe there was an attribute you could
Is Software Testing really given its importance at the academic level? I believe there
Although this question and this question are close to what I'm asking, I believe

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.