What's the difference between a stack and a heap
Utilisateur anonyme
Stack is a LIFO date structure; when one extracts data from it, it will be in the reverse order that the data was pushed onto it. Heap is a tree data structure where the root node is always either the largest, or smallest element. Taking elements out of the heap is O(1). Putting elements into the heap is O(log n)