1.

What Is The Difference Between A Stack And An Array?

Answer»

STACK:

i) Stack is a ordered collection of items.
ii) Stack is a dynamic object WHOSE size is constantly changing as items are PUSHED and popped.
iii) Stack may contain different data types.
IV) Stack is declared as a structure containing an ARRAY to hold the element of the stack, and an INTEGER to indicate the current stack top within the array.

ARRAY:

i) Array is an ordered collection of items.
ii) Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array.
iii) It contains same data types.
iv) Array can be home of a stack i.e. array can be declared large enough for maximum size of the stack.

STACK:

i) Stack is a ordered collection of items.
ii) Stack is a dynamic object whose size is constantly changing as items are pushed and popped.
iii) Stack may contain different data types.
iv) Stack is declared as a structure containing an array to hold the element of the stack, and an integer to indicate the current stack top within the array.

ARRAY:

i) Array is an ordered collection of items.
ii) Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array.
iii) It contains same data types.
iv) Array can be home of a stack i.e. array can be declared large enough for maximum size of the stack.



Discussion

No Comment Found