Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

a building Stack data structure

Rating
-
Sold
-
Pages
3
Uploaded on
09-02-2024
Written in
2023/2024

this document contains gives all information about stack its definition, structure , uses,implementation ,applications and real life analogy , limitations . This document gives a explanation of stack in simple words.

Institution
Course

Content preview

STACK DATA STRUCTURE
1)What is a Stack?
A Stack is a linear data structure that follows the LIFO (Last-In-First-Out) principle. Stack
has one end, whereas the Queue has two ends (front and rear). It contains only one
pointer top pointer pointing to the topmost element of the stack. Whenever an element is
added in the stack, it is added on the top of the stack, and the element can be deleted only
from the stack. In other words, a stack can be defined as a container in which insertion
and deletion can be done from the one end known as the top of the stack.

2. Structure of stack :

Conceptually, a stack can be visualized as a collection of elements arranged in a vertical
structure, resembling a stack of plates or books.
Elements are added or removed from the top of the stack.
Unlike arrays or linked lists, stacks typically support only a limited set of operations.



2)How Does a Stack Work?
A stack follows the Last-In, First-Out (LIFO) principle, meaning the last item added to the
stack is the first one to be removed.
You can only interact with the top item of the stack.

3)Operations on a Stack :

Push: Adding an item to the top of the stack.
Pop: Removing the top item from the stack.
Peek (or Top): Looking at the top item without removing it.
Is Empty: Checking if the stack is empty.
Size: Finding out how many items are in the stack.

Written for

Institution
Course

Document information

Uploaded on
February 9, 2024
Number of pages
3
Written in
2023/2024
Type
Class notes
Professor(s)
Krishna
Contains
All classes

Subjects

$9.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
krishnawaria355

Get to know the seller

Seller avatar
krishnawaria355 RVM
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions