Before Becoming A Card Shark, You Need To Know This Method - Part 2

Alice, Bob, and Charlie are all sorting standard poker decks .

Alice looks through the deck until she finds the ace of hearts, then sets it aside and starts over. Now she looks for the two of hearts until she finds it, then sets it aside. She continues in this way until she's put the cards in order.

Bob first sorts the cards into piles by suit (4 piles) and only then sorts them into their final order.

Charlie decides to sort the cards into piles by number instead of by suit before the final sort (13 piles).

The actions they take in sorting the cards take the following amounts of time:

  • moving a card to a pile: n 1 4 \frac{n-1}{4} seconds, where n n is the number of piles we are sorting into,
  • looking at a card to decide what to do: 0.5 seconds,
  • any other "actions" should be considered to take no time.

If they were given 1000 1000 randomly shuffled decks to sort, in what order would we expect them to finish?

Image Credit: Richard Heaven
Alice, Bob, Charlie Charlie, Bob, Alice Bob, Charlie, Alice Bob, Alice, Charlie

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Edo Suhartanto
Apr 3, 2014
  1. Alice is using Selection Sort
  2. Bob is using Bucket Sort with 4 bucket
  3. Charlie is using Bucket Sort with 13 bucket

based on these configurations, with 1000 data Selection sort is the slowest, then Bucket Sort with 13 bucket, then the fastest is Bucket Sort with 4 bucket.

so the answer is Bob, Charlie, and Alice (see also http://en.wikipedia.org/wiki/Sorting_algorithm)

oh i guess

math dude - 7 years, 2 months ago

I went to the wiki link u provided...(only saw bucket sort as i already know the selection sort)....kind of understood it :/

Tanya Gupta - 7 years, 2 months ago
Tanya Gupta
Apr 1, 2014

Can someone please post a solution???I went merely on intuition.....

Alice takes a minimum time of 1000 cards x 0.5 seconds if she's lucky and finds the right card each time. Maximum time is 1000! x 0.5 seconds if she has to look all pile left for a card. Since she has only one pile (sorted cards), there is no time to be computed. 500 <= t(A) <= 0.5x1000!

Bob will take (3/4+0.5)x1000 Charlie will take (12/4+0.5)x1000

Since it is very unlikely that Alice will find cards in first attempt, she'll be the slowest. Thus we have: Bob, Charlie and Alice.

(And my fat fingers touched the wrong answer).

Clistones Pedreira - 7 years, 2 months ago

Log in to reply

Thanx for the solution...Seems really short and sweet...A pity about your fingers:(

Tanya Gupta - 7 years, 2 months ago

Alice takes a minimum time of 1000 cards x 0.5 seconds if she's lucky and finds the right card each time. Maximum time is 1000! x 0.5 seconds if she has to look all pile left for a card. Since she has only one pile (sorted cards), there is no time to be computed. 500 <= t(A) <= 0.5x1000!

Bob will take (3/4+0.5)x1000 Charlie will take (12/4+0.5)x1000

Since it is very unlikely that Alice will find cards in first attempt, she'll be the slowest. Thus we have: Bob, Charlie and Alice.

(And my fat fingers touched the wrong answer).

Satyam Sharma - 7 years, 2 months ago
Sanjay Kamath
Jun 3, 2014

Based on common sense it seems thus.. - 4 packs of 52 cards will take less time than 13 packs of 52 cards / - finding cards one card at a time will take a max of 26 seconds for the first card, 25.5 secs for
the second and so on which will far exceed the first two options.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...