ajay-dhangar / algo

This repository contains a collection of data structures and algorithms implemented in various programming languages. It is designed to help learners understand key concepts through hands-on examples. Contributions and improvements are welcome!
https://ajay-dhangar.github.io/algo/
MIT License
73 stars 215 forks source link

[Feature]: Kth Largest Element Using Min Heap #1743

Open yashksaini-coder opened 2 hours ago

yashksaini-coder commented 2 hours ago

Feature Name

Kth Largest Element Using Min Heap

Feature Description

Find the Kth largest element in an unsorted array. Use a min heap to store the top K elements. Insert elements into the min heap. If the heap size exceeds K, remove the smallest element. At the end, the root of the min heap is the Kth largest element.

Motivation

This provides an O(nlogk) time complexity solution for finding the Kth largest element.

Implementation Suggestions (Optional)

No response

Feature Type

New Algorithm

Does this feature require additional resources?

References (Optional)

No response

yashksaini-coder commented 2 hours ago

@ajay-dhangar can you assign me this issue to