Question

I read that the 'heap' is basically a binary tree. But this definition of Heap got me thinking about Java's Heap Space. Java's heap is a place where all the objects are created. But these objects surely are not sorted as per a binary tree? Because what would be the purpose of that?

Was it helpful?

Solution

A binary heap is a heap data structure created using a binary tree while java heap is the memory used by JVM to manage the objects. You seems to be confused between these two concepts.

Datastructure such as PriorityQueue uses the binary heap tree concepts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top