There is a bus with 100 labelled seats (labelled from 1 to 100). There are 100 persons standing in a queue. Persons are also labelled from 1 to 100.
People board on the bus in sequence from 1 to n. The rule is, if the person ‘i’ boards the bus, he checks if seat ‘i’ is empty. If it is empty, he sits there, else he randomly picks an empty seat and sits there. Given that 1st person picks seat randomly, find the probability that 100th person sits on his place i.e. 100th seat.
As the first person has taken the seat randomly, this means the 1st set is vacant. After that, all the passengers will take seat according to their sequence except the seat taken by the 1st person. So, at last, there will be one person left i.e. the 99th person that has the choice of taking the seat from either of the remaining two seats i.e. 100th seat or the other one. On the basis of this, the 100th person will get the seat and the probability of choosing a seat from the 2 seats is 1/2.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.