ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل Ashfaque Choudhary , Programmer Analyst , Almarai
تاريخ النشر: 2014/11/15
Ibraheem AlKilanny
من قبل 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.

المزيد من الأسئلة المماثلة