ProgrammingModerate
The largest gap between consecutive values of the sorted list 1, 4, 9, 16 is which value?
- A. 5
- B. 7
- C. 8
- D. 12
Correct answer: B. 7
The consecutive differences are 3, 5 and 7, and the largest is 7, between 9 and 16.
More C Programming questions
- The median of the sorted keys 2, 4, 6, 8 with integer division is which value?
- In the keys 3, 1, 3, 2, 1, the mode (most frequent key) is needed. With ties, the smallest key wins. Which is the mode?
- Records with a name and a score are stored in an array and sorted with a comparator that compares the names with strcmp. Which field…
- Sorting 2 x 10^6 structs with qsort in C takes about how many comparisons?
- A list of records must be kept sorted while new records arrive one at a time. Which structure gives the best total cost for 10^5 inserts…
- Which sort is stable and runs in O(n log n) worst case, suitable for struct arrays that must keep equal-key order?