You are not logged in. Please login at to post your questions!


COOLING: Need Algorithm/DS

Can someone tell me what is the name of the Algorithm/DS to be used for this problem ?

asked 26 Apr '12, 18:28

exploit's gravatar image

accept rate: 0%

edited 10 Jul '12, 12:39

admin's gravatar image

0★admin ♦♦

just try to put pies in increasing order in the racks, you'll get AC. :) (try this)


answered 26 Apr '12, 23:37

cyberax's gravatar image

3★cyberax ♦
accept rate: 20%

edited 27 Apr '12, 06:12

We can maximise the number of pies which can be cooled if we greedily place lowest weight pie on lowest possible rack which can support it and this can be efficiently done if we sort the two arrays you can look at the solution if you want . algorithm : sorting and greedy


answered 12 Feb '17, 12:28

hsraktu's gravatar image

accept rate: 0%

edited 12 Feb '17, 12:33

I suggest you to use Insertion sort to sort the array, since it is efficient enough with small arrays, just like in this example - and it doesn't use recursion, so memory requirements will be quite low.

Here is my solution (though written in Pascal) - that I'm really proud of :D Solution


answered 27 Apr '12, 00:38

pera93's gravatar image

accept rate: 9%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 26 Apr '12, 18:28

question was seen: 5,141 times

last updated: 12 Feb '17, 12:33