Stack |
Array |
---|
It may contain different data types. | It contains the same data types. |
It is a linear data structure in which insertion (PUSH) and deletion (POP) can be done only from only one end ie Top. | It is a linear Data Structure in which insertion and deletion can take place in any position. |
It is a static object. | It is a dynamic object. |
In a stack, there’s no random-access operation; there are only Push and Pop. | Elements can be retrieved randomly in an array. |
It follows LIFO or FILO order. | Data can be entered at any position and be read from any position. |
The element that is first entered would be the last removed. | The element can be entered or removed in any order. |
| Stack |
| | Array |
|