NiuNiu MaTe
NiuNiu MaTe
Dec 31, 2021 · Fundamentals

Master TopK: From Simple Sorts to Heap and QuickSelect Solutions

This article explains the TopK problem, compares sorting‑based O(nk) approaches with heap‑based O(n + k log n) and quick‑select O(n) methods, and provides complete Java implementations for each technique, helping readers ace interview questions on finding the largest K elements.

Heapquickselectsorting
0 likes · 13 min read
Master TopK: From Simple Sorts to Heap and QuickSelect Solutions
Programmer DD
Programmer DD
Jun 19, 2021 · Fundamentals

How to Find the k‑th Largest Element in an Unsorted Array: 4 Efficient Methods

Learn four practical approaches to locate the k‑th largest element in an unsorted array—including sorting, insertion, min‑heap, and divide‑and‑conquer techniques—complete with step‑by‑step explanations, complexity analysis, and a full Java implementation for algorithmic interview preparation.

Javakth largestmin-heap
0 likes · 10 min read
How to Find the k‑th Largest Element in an Unsorted Array: 4 Efficient Methods