Computer Science, asked by abhishekmittal12681, 9 months ago

What is heap how it is a different from binary tree?

Answers

Answered by annoyinggirl
1

Answer:

Heap just guarantees that elements on higher levels are greater (for max-heap) or smaller (for min-heap) than elements on lower levels, whereas BST guarantees order (from "left" to "right"). If you want sorted elements, go with BST. Heap is better at findMin/findMax ( O(1) ), while BST is good at all finds ( O(logN) ).

Similar questions