Write a c program to find out the ith largest number among the given set of numbers without using sorting?

1

1 Answers

Albus Severus Potter Profile
It is just an algorithm I am  giving ...

Way 1.construct a heap ...
Delete "I" elements and return the I'th element  for I'th minimum/largest number without sorting,

way 2.you can also construct trees( AVL ,red-black,2-4) ...
Inorder traversel of the tree gives sorted numbers ...
Logically it is not done by SORTING the elements ... ;)

order is n(log(n))

Answer Question

Anonymous