Aug 30, 2013 at 10:59am UTC
I'm having this problem.
While finding the primes , I do not know how to make it into one array so that...
Aug 30, 2013 at 11:28am UTC
Your problem is not clear. Please show what you are trying to do.
Aug 30, 2013 at 1:31pm UTC
Are you trying to find prime numbers or largest element? I don't see anything in here that tests primality.
Aug 30, 2013 at 1:42pm UTC
ex:
a = {5 8 1 3 9 6 10}
k = 3
Print >>8
Aug 30, 2013 at 1:56pm UTC
I don't understand that output at all. You're going to have to explain why you want that to happen.
Aug 30, 2013 at 2:26pm UTC
It's a typical heap problem, you can start from this data structure first.
sorry to be on my phone, and hard to write full code, feel free to ping me if you cannot fully understand the heap.
Aug 30, 2013 at 4:03pm UTC
Are you trying to find the kth largest element in the array?
Then just sort the array in descending order and output the kth element.