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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:26:30+00:00 2026-05-14T21:26:30+00:00

I am reading Probability and Computing by M.Mitzenmacher and E.Upfal. I am having problems

  • 0

I am reading “Probability and Computing” by M.Mitzenmacher and E.Upfal. I am having problems understanding how the probability of comparison of two elements is calculated.

Input: sorted list (y1,y2,…,yN) of numbers. We are looking for pivot element (randomly). Question: what is probability that two elements yi and yj (j>i) will be compared?

Answer (from book): yi and yj will be compared if either yi or yj will be selected as pivot in first draw from sequence (yi,yi+1,…,yj-1,yj). So the probablity is: 2/(j-i+1).

The problem for me is the initial claim: for example, picking up yi in the first draw from the whole list will cause the comparison with yj (and vice-versa) and the probability is 2/n.

So, rather the “reverse” claim is true — none of the (yi+1,…,yj-1) elements can be selected before yi or yj, but the “pool” size is not fixed (in first draw it is N for sure, but on the second it is smaller).

Could someone please explain how the authors come up with such a simplified conclusion?

Edit1: some good soul polished my post, thank you :-).

Edit2: the list is sorted initially.

  • 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-14T21:26:31+00:00Added an answer on May 14, 2026 at 9:26 pm

    The answer given by the authors is correct, though I still don’t see how they jumped to the conclusion that easily and fast.

    Let denote by L=j-i+1. Actual values of j and i don’t matter here, what matters is L. Let also denote by P(N,L) probability of comparing yi and yj element from ordered sequence of numbers of size N.

    Facts:

    • P(N,2) = 1
    • P(N,L) = 2/N+1/N * ( P(N-1,L)+P(N-2,L)+P(N-3,L)+…+P(L,L) )

    This sum looks ugly, but after two tests it appeared that the P(N,L) is probably equal to 2/L. Let’s check it out:

    • P(N,L=2) = 1 = 2/2 = 2/L
    • let’s assume P(N,L) = 2/L
    • P(N+1,L) = 2/(N+1) + 1/(N+1) * ( P(N,L) + … P(L,L) ) = 2/(N+1) + (N-L+1)*1/(N+1)*2/L = 2/L

    And since L=j-i+1, we get 2/(j-i+1).

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

Sidebar

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.