stack

Stack vs Array

Stack is a linear data structure that appears like a list. A stack appears like a sequential collection of constituting elements. Array is also a linear data structure that consists of a collection of various elements that have the same data type. An array’s size is pre-decided. It stores all the values at a location known as the index of values.

Posted September 10, 2022 by Rohith and Anusha ‐ 2 min read

quick-references blog stack array differences

Stack vs Queue

The primary difference between Stack and Queue Data Structures is that Stack follows LIFO while Queue follows FIFO data structure type. LIFO refers to Last In First Out. It means that when we put data in a Stack, it processes the last entry first. Conversely, FIFO refers to First In First Out. I

Posted September 10, 2022 by Rohith and Anusha ‐ 2 min read

quick-references blog stack queue differences

Stack Allocation vs Heap Allocation

Stack Allocation happens on contiguous blocks of memory. We call it a stack memory allocation because the allocation happens in the function call stack. The size of memory to be allocated is known to the compiler and whenever a function is called, its variables get memory allocated on the stack. Heap Allocation is allocated during the execution of instructions written by programmers. Note that the name heap has nothing to do with the heap data structure. It is called heap because it is a pile of memory space available to programmers to allocate and de-allocate.

Posted September 9, 2022 by Rohith and Anusha ‐ 1 min read

quick-references blog stack heap differences

Stack

Java Collection framework provides a Stack class that models and implements a Stack data structure. The class is based on the basic principle of last-in-first-out. In addition to the basic push and pop operations, the class provides three more functions of empty, search, and peek.

Posted August 18, 2022 by Anusha ‐ 4 min read

core java programming stack class collections

Subscribe For More Content