• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Reserved seat

 
Saloon Keeper
Posts: 3293
146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A nice one I heard at the office the other week. Not necessarily a programming thing though, but here goes:

You are the last one of a queue of 100 people, waiting to get aboard of an airplane with exactly 100 seats. All have a reserved seat. There is, however, a confused person (not you of course) who will pick a free seat at random. For all others it holds that each will take his reserved set, unless occupied, in which case he himself will also pick a free seat at random. The question is of course: what is the chance that you'll end up in your reserved seat?
 
lowercase baba
Posts: 12749
51
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
100%.  If i get on the plane and someone is in my seat, I'm booting them out.
 
Marshal
Posts: 64653
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That obviously isn't a R**nair plane, then.
 
Bartender
Posts: 2291
95
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

fred rosenberger wrote:100%.


 
 
Bartender
Posts: 1025
18
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the train, every few weeks we would get the "Due to the lateness of the service no reservations are in place!".  
And then the chaos started and would last the whole journey.        
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I can even figure this out for a queue of 2 people.

We know that 1 is the confused person and that they will pick a seat at random. So 1 either picks seat 1 (their assigned seat) or seat 2 (my seat), each with probability 1/2. Then I pick the other seat, which is my seat with probability 1/2.

Right?

 
Paul Clapham
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I'm right, then with 3 people in the queue the chance that I will get my assigned seat is still 1/2, there's just a more tedious enumeration of possibilities. So obviously the answer to Piet's original question is 1/2.
 
Piet Souris
Saloon Keeper
Posts: 3293
146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul is spot on. But how to prove it? Well, suppose that person A is trying to get to his seat. A is not the confused person, but he finds his seat taken. So now A himself picks a seat at random, as if he was the confused person.

Can you find a two line proof, using mathematical (full) induction? Or can you think of a way to let the computer calculate it?

@Fred
Incorrect. If it is Junilu sitting in your seat, you'd be flying through the air much sooner than the plane.

But given the many non-serious reactions, I'll put my next puzzle (if at all) in the Meaningless Drivel.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!