What is the difference between ARRAY and STACK?

Questions by ramesh_etta

Showing Answers 1 - 36 of 36 Answers

rose

  • Nov 10th, 2006
 

STACK follows LIFO. Thus the item that is first enetered would be the last removed.

In array the items can be entered or removed in any order. Basically each member access is done using index. No strict order is to be followed here to remove a particular element.

  Was this answer useful?  Yes

Pushpa Siva Kumar

  • Dec 14th, 2006
 

Array is a linear Data Structure in which insertion and deletion can take place in any position.  The elements can be retrieved randomly in Arrays.

Stack is also a linear data structure in which insertion and deletion will take place at the top position alone. It follows LIFO order i.e. last in first out. The element in the top most position alone can be retrieved.

  Was this answer useful?  Yes

Jyotiranjan

  • Mar 1st, 2007
 

All the above comments are true but I want to add to it is that the size of array is fixed while in a stack its not fixed.It something like dynamic allocation.Its size can grow and shrink.

  Was this answer useful?  Yes

j4jrm84

  • Mar 1st, 2007
 

Basic Difference is that the size of array is fixed while stack size can grow and shrink.Stack is a dynamic concept

  Was this answer useful?  Yes

shamanth

  • Aug 31st, 2015
 

We can create stack and array as dynamic and also static

  Was this answer useful?  Yes

Balakrishna

  • Nov 17th, 2015
 

Conceptual wise both are different. I think comparison is not possible. But to my knowledge size if local array is declared then it stores in stack. Here size of an array should be fixed before compile time. But in stack all operation related to local variables takes place. Stack can be shrink or grow.

  Was this answer useful?  Yes

Ali

  • Nov 11th, 2016
 

Can you explain why both are static?

  Was this answer useful?  Yes

Dan kinyua

  • Dec 2nd, 2016
 

To my understanding both array and stacks are data structures used in storage of data, but a stack is a method of implementing the way data is stored and manipulated in Array.

  Was this answer useful?  Yes

ASHU

  • Dec 9th, 2016
 

Array and stack both data structure and also store same type data. but stack have some property i.e PUSH, POP etc.
Array is static But When Stack creates using Array then it is static and when Stack creates using Link list then it is Dynamic. so stack is static or dynamic but array always static.

  Was this answer useful?  Yes

Chandan Kumar Sahu

  • Mar 1st, 2017
 

In an array, you have a list of elements and you can access any of them at any time. (Think of a bunch of wooden blocks all laid out in a row.)
But in a stack, theres no random-access operation; there are only Push, Peek and Pop, all of which deal exclusively with the element on the top of the stack.

  Was this answer useful?  Yes

Teja

  • Oct 21st, 2017
 

Main difference is in access. With stack we can not access values randomly but with array we can access any item any time.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions