Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is the difference between Stack and Heap and what is it?

user-image
Question ajoutée par Ashfaque Choudhary , Programmer Analyst , Almarai
Date de publication: 2014/11/15
Ibraheem AlKilanny
par Ibraheem AlKilanny , Software Development Team Leader , UnifiAccess

Stack is a data-structure which maintains its elements as last-in-first-out. You can imagine a stack as some rocks on each other, so you cannot remove the elements in the bottom without removing first the elements at the top. This order is very important in computer, especially when dealing with function calls and math inductions (recursion).

Heap is sometimes called (priority-queue), which is a type of queue that not fearly orders its elements. That is, in the natural queue, the first element enters the queue is the first one to go out. But in a heap, the first element goes out is the one having the most top priority, regardless of enetering first or last.

More Questions Like This