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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:03:56+00:00 2026-05-28T17:03:56+00:00

Here is the question: There are 5 sorted list A,B,C,D,E, which has the same

  • 0

Here is the question:

There are 5 sorted list A,B,C,D,E, which has the same length n. The question is to find an algorithm that can median of this 5 list in O(logn) time. I am thinking of a general idea but I could not figure out the exact complexity it takes.

Assume the median of A,B,C,D,E is a,b,c,d,e. And we have a<b<c<d<e. It is obvious that I could throw away the first half of array A and the last half of array E. Now I have 5 new arrays: B,C,D stay the same, each has n numbers; A’ and E’ each has n/2 numbers left. I then compute the median of A’ and E’ as a’ and e’, compare them to b,c,d. If the new order of 5 medians is a'<b<e'<c<d, then I through away the first half of a’ (n/4 numbers) and the last n/4 numbers of array D, because we need to throw away equal numbers on both sides of the final median. The process continue…

I have a kind of feeling that the algorithm is O(logn). But I don’t know the exact proof. In the first logn steps, we can surely reduce the candidate numbers to 3n, adding up all the remaining numbers of the 5 lists. The first time we kick out n numbers, the second time at least n/2 numbers, the third time n/4 numbers and so on. However, I don’t know how to analysis after I get 3n remaining numbers.

Can this algorithm actually give me O(logn)?

  • 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-05-28T17:03:57+00:00Added an answer on May 28, 2026 at 5:03 pm

    Yes, it actually can. Just look at those statements

    • We can get final result only if we have one list. Unless we have at least two lists, we can’t speak about this.
    • Every step of algorithm we’re cutting by half two of lists. If there is only one element in list, we’re deleting whole list.
    • Let’s count, how many steps take it to delete the list. On first deletion we’ll delete n/2 items, an second – n/4 and so on till one element left, when we’re finally deleting the list. It will take about log(n) operations (don’t know if it’s really log(n) or log(n)+1 but in both cases it is O(log(n)) ).
    • So, we need to eliminate 5 lists (operation of finding median in last list can be generalized to operation of reducing lists). It takes O(log(n)) to eliminate one of them, so we’ll do all the stuff also in O(log(n)), cause 5 is constant.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a question here in stackoverflow with the same title but that is
the question is like this: there is a sorted list of n numbers. Given
I see there is a question here but there is no definite answer. Has
I am aware that there is a similar question here with no solution. I'm
In answering another persons question here on SO, I discovered that there is a
This question has been asked here in one form or another but not quite
This is more of a 2nd part of a question that start off here
Simple question here: is there any way to convert from a jagged array to
a simple question here Is there a way to change the text click here
There is a similar question here but it only covers some of the issues

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.