Abstract Data Types
This is the first post of Data Structures.
Linear Data Structures
We will begin four study of Data Structures by considering four simple but very powerful concepts.
Once an item is added, it stays in that position relative to the other elements that came before and came after it. Collections such as these are often referred to as linear data structures.
Let's consider about the first simple Data Structure.
Stack ( push down stack )
A stack is an ordered collection of items where the addition of new items and the removal of existing items always takes place at the same end. This end is commonly referred to as the “top” The end opposite the top is known as the “base”.
The basic rule in the stack is The most recently added item is the one that is in position to be removed first. This ordering principle is sometimes called LIFO.( last-in first-out )It provides an ordering based on length of time in the collection. Newer items are near the top, while older items are near the base.
Example of a stack -
Let's take a example stack of primitive python objects.
Stacks are fundamentally important, as they can be used to reverse the order of items. The order of insertion is the reverse of the order of removal.
Let's see the reversal property of stack.
The above figure shows the Python data object stack as it was created and then again as items are removed. Note the order of the objects.
That is the basics about stack data structure.
Hope you get a knowledge about basic stack data structure.
See you soon.
Thank you.
Linear Data Structures
We will begin four study of Data Structures by considering four simple but very powerful concepts.
- Stack
- Queue
- Deque (double ended queue)
- List
Once an item is added, it stays in that position relative to the other elements that came before and came after it. Collections such as these are often referred to as linear data structures.
Let's consider about the first simple Data Structure.
Stack ( push down stack )
A stack is an ordered collection of items where the addition of new items and the removal of existing items always takes place at the same end. This end is commonly referred to as the “top” The end opposite the top is known as the “base”.
The basic rule in the stack is The most recently added item is the one that is in position to be removed first. This ordering principle is sometimes called LIFO.( last-in first-out )It provides an ordering based on length of time in the collection. Newer items are near the top, while older items are near the base.
Example of a stack -
Let's take a example stack of primitive python objects.
Stacks are fundamentally important, as they can be used to reverse the order of items. The order of insertion is the reverse of the order of removal.
Let's see the reversal property of stack.
The above figure shows the Python data object stack as it was created and then again as items are removed. Note the order of the objects.
That is the basics about stack data structure.
Hope you get a knowledge about basic stack data structure.
See you soon.
Thank you.



Comments
Post a Comment