Data Structures & AlgorithmsHard

For every window of length 3 in 9 2 7 4 1 8, sort the window and take its MIDDLE value. What is the largest of these middle values?

  1. A. 7
  2. B. 9
  3. C. 6
  4. D. 1

Correct answer: A. 7

The median of a window of three is its middle value after sorting; taking the largest of these medians gives the answer. The window maximum or minimum is a different statistic.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic