algorithms.tutorialhorizon.com

Find the Kth Smallest/Largest Element in an Array | Algorithms

Objective: Given an array of integers. write an algorithm to find the Kth Smallest or largest element in the array. There are many ways to solve this problem, In this article we will solve this problem using priority queue (min heap for kth smallest element and max-heap for kth largest element)