Why is the brute-force approach less ideal here?

Practice this question from Kth Largest Element - Size-K Min-Heap Pattern Practice Quiz, with options and an explanation.

Question

Why is the brute-force approach less ideal here?

Option A — Correct answer

Sorting the full array does more work than needed.

Option B

It always uses constant time

Option C

It avoids all comparisons

Option D

It requires no extra state

Explanation

Sorting the full array does more work than needed.

Kth Largest Element - Size-K Min-Heap Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker