What are the advantages and disadvantages of a heap?
Answer:
-Storing data on the heap is slower than it would take when using the stack.
However, the main advantage of using the heap is its flexibility. That's because memory in this -Structure can be allocated and remove in any particular order.
Slowness in the heap can be compensated if an algorithm was well designed and implemented.