Glossary term

What is heap? Meaning for developers

In DSA

A complete binary tree stored in an array. Every parent comes before its children in order, so the best item is always at index 0. Push and pop cost O(log n).

Learn it properly · DSALesson 46: Heaps and Top-KBuild a priority queue by hand in JavaScript, then use it to find the top K items.

All DSA terms

In CS Foundations

The memory area for objects that live longer than one function call. A garbage collector frees what is no longer used.

Learn it properly · CS FoundationsLesson 0: How a Computer Runs Your ProgramFrom source code to machine code: compiling, interpreting and JIT, the stack and the heap, function calls, stack overflow and garbage collection.

All CS Foundations terms

Related terms

← All glossary terms, A to Z