ProgrammingVery hard
Records (x,5), (y,2), (z,5), (w,2), (v,9) are reduced to one record per key by keeping the last record seen for each key, then sorted by key. Which names remain in order?
- A. y x v
- B. w z v
- C. x w v
- D. w z y
Correct answer: B. w z v
The last record with key 2 is w, with key 5 it is z, and with key 9 it is v. Sorted by key these are w, z, v.
More C Programming questions
- Insertion sort (shift larger elements right, then place the key) is applied to {4, 1, 3, 2}. How many element shifts happen in total?
- The third smallest value of the keys {40, 10, 30, 20, 50} is which value?
- How many inversions does the array {2, 4, 1, 3, 5} contain?
- Records (A, 3, x), (B, 3, a), (C, 1, m) are sorted by score descending and then by the name field ascending. What is the order of the…
- A struct P ps[] holds records, and an array of pointers pp[] is sorted with qsort. What happens to the records in ps?
- Which argument is correct as the size parameter in qsort for an array struct P recs[] of n records?