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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top