life is too short for a diary



Posts Tagged: heap

Cribsheet for Heap data structure

A quick reference guide for heap data structures, algorithms, and common interview patterns. Covers max/min heaps, heapsort, priority queues, and practical implementations in Java and Python...

Continue reading → java python algorithm heap



Sort Characters By Frequency solution leetcode

Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string...

Continue reading → leetcode java python heap



Find kth largest element in an array

The other day I stumble upon the question to find the kth largest element in the array. At first glance, I thought the solution was trivial. But later I thought that there are multiple ways to achieve efficient solution...

Continue reading → algorithm ruby heap max-heap projects