The first record in the data file contains a single number between 1 and 10. The remainder of the file consists of records with one or more numbers, with one or more spaces separating each two numbers. The numbers on the second and subsequent records lie in the range -1,000,000 to +1,000,000.
Write a program that reads the first number (call it N) and then finds and displays the Nth largest number of all the numbers in the rest of the records. For example, if N is 1, your program should find the largest number overall. If N is 9, your program should find the ninth largest number overall.
You should assume that the file contains many thousands of numbers. However, here is a sample small file to illustrate the task. The sixth
largest number in the file is 9384.
Input:
6 203 43 56 1046 389 173 40393 323 482 24 3423 348 8696 3452 2345 5672 23 3523 254 345 44 6456 656 7878 54 0 2345 45 4564 504 34 594 5933 393 245 219 1402 234 14 1 24 21902 34214 829 1344 12414 535 25757 456 34564 7 2 459 495 94003 9384 574 904 300 78 893 9 3 1999 2045 900 290 390 3023 122 679 91Output:
9384