0% found this document useful (0 votes)
5 views

Stack

A Stack is a linear data structure that follows the LIFO (Last In First Out) principle, allowing operations such as push, pop, and isEmpty. It has a bounded capacity and is used in various programming tasks, including function calls. The time complexity for standard operations is generally O(1), making it efficient for managing data in a specific order.

Uploaded by

onalbaydastan77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Stack

A Stack is a linear data structure that follows the LIFO (Last In First Out) principle, allowing operations such as push, pop, and isEmpty. It has a bounded capacity and is used in various programming tasks, including function calls. The time complexity for standard operations is generally O(1), making it efficient for managing data in a specific order.

Uploaded by

onalbaydastan77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Task 2.

(50 point)>>Dastan
Write pseudocode for the Stack data structure with operations Push, Delete, Stack-empty .Give
example. Analyze Stack data structure. What policy does Stack implement? Obtain running time
for operations.
>>>
Definition:
Stack is a linear data structure which operates in a LIFO(Last In First Out) or FILO (First In
Last Out) pattern.
It is named stack as it behaves like a real-world stack, for example – a deck of cards or a pile of
plates, etc.
Stack is an abstract data type with a bounded (predefined) capacity.
It is a simple data structure that allows adding and removing elements in a particular order.
The order may be LIFO(Last In First Out) or FILO(First In Last Out).

Standard Stack Operations:


push() – Place an item onto the stack. If there is no place for new item, stack is in overflow
state.
pop() – Return the item at the top of the stack and then remove it. If pop is called when stack is
empty, it is in an underflow state.
isEmpty() – Tells if the stack is empty or not
isfull() – Tells if the stack is full or not.
peek() – Access the item at the i position
count() – Get the number of items in the stack.
change() – Change the item at the i position
display() – Display all items in the stack

Conclusion:
Stack is a very useful data structure with many uses. It is an essential part of every program as all
the programming languages internally use stack for function calls and many more operations. To
summarize , the time and space Complexities of Stack are:

You might also like