[algogeeks] Re: SUN Microsystem Question

2010-12-27 Thread Gene
It would be interesting to do some tests. Asymptotic performance isn't always important. It's possible that since we are looking for only the top 10 elements, we'll get better run times using a simple linear scan to find the insertion point (as in insertion sort) rather than the more complex

Re: [algogeeks] Re: SUN Microsystem Question

2010-12-25 Thread Satya
@Dave, I think you meant* *MIN** Heap here? On Fri, Dec 24, 2010 at 6:46 PM, Dave dave_and_da...@juno.com wrote: @Bittu: Using the first 10 numbers, build a max heap. Then add each number into the 11th array position (always the 11th position) and perform the up-heap operation. At the end

Re: [algogeeks] Re: SUN Microsystem Question

2010-12-25 Thread Satya
@Dave, you are right. MAX Heap is correct for your always 11th position removal logic. . Satya On Fri, Dec 24, 2010 at 9:45 PM, Satya satya...@gmail.com wrote: @Dave, I think you meant* *MIN** Heap here? On Fri, Dec 24, 2010 at 6:46 PM, Dave dave_and_da...@juno.com wrote:

[algogeeks] Re: SUN Microsystem Question

2010-12-24 Thread Dave
@Bittu: Using the first 10 numbers, build a max heap. Then add each number into the 11th array position (always the 11th position) and perform the up-heap operation. At the end of the input, discard the 11th number in the heap. The remaining numbers will be the 10 maximum. O(n log k) where n = the

[algogeeks] Re: SUN Microsystem Question

2010-12-17 Thread awesomeandroid
A compiled language is one where the program, once compiled, is expressed in the instructions of the target machine. For example, an addition + operation in your source code could be translated directly to the ADD instruction in machine code. An interpreted language is one where the instructions