Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

GROUP 3

Data Structures and


Algorithms
Introduction
Importance of Data Structures
-Users may easily access and
manipulate the data they require in
the right manner thanks to data
structures. The main purpose of data
structures is to organize information
so that both computers and people
can interpret it more easily.
Efficiency and Performance in Software
Development
-In the event that its computational cost, or resource
consumption, is at or below a certain threshold. Software
developers may accomplish the following by combining the
proper data structure with the correct algorithm: Efficiency:
The combination of optimized algorithms and data
structures results in quicker execution times, less resource
use, and enhanced overall performance.}
EFFICIENCY AND PERFORMANCE IN
SOFTWARE DEVELOPMENT
2 3 4 5
Optimized Resource Management: Scalability: The capacity Crucial in creating
Algorithms: Efficient Effective use of system to maintain or improve software that not only
software relies on resources such as efficiency as the system runs smoothly and
well-designed memory and processor scales up is vital for quickly but also
algorithms that cycles is a hallmark of supporting growing user conserves memory,
reduce computational efficient software, bases or data volumes processing power, and
complexity and preventing bottlenecks without a corresponding energy.
enhance speed. and ensuring increase in resource
responsiveness. consumption.
Overview of CommonData
Structures
-One way to store and arrange data
so that it may be quickly and simply
utilized to carry out activities and
produce desired outcomes is by
using data structures. The most
fundamental types of data structures
include trees, heaps, graphs, linked
lists, stacks, queues, hash tables, and
Stacks
• It is a linear data structure that follows a particular order
in which the operations are performed.
• The order may be LIFO(Last In First Out) or FILO(First
In Last Out).
• LIFO implies that the element that is inserted last, comes
out first.
• FILO implies that the element that is inserted first,
comes out last.
Consider an example of plates
stacked over one another in the
canteen. The plate which is at the top
is the first one to be removed, i.e. the
plate which has been placed at the
bottommost position remains in the
stack for the longest period of time.
So, it can be simply seen to follow
LIFO(Last In First Out)/FILO(First
In Last Out) order.
Basic Operations on Stack in
Data Structures

PUSH POP PEEK


PUSH OPERATION
• Inserting a new element in the stack
is termed a push operation.
• Since you have only one end to insert
a unique element on top of the stack,
it inserts the new element at the top
of the stack.
POP OPERATION
• Pop operation refers to removing the
element from the stack again since
you have only one end to do all top
of the stack.
• So removing an element from the top
of the stack is termed pop operation.
PEEK OPERATION
• Peek operation refers to retrieving the
topmost element in the stack without
removing it from the collections of
data elements.
Implementation
and Real-World
Application
Implementation of
Stack in Data
ARRAY
Structures
YOU CAN PERFORM THE
IMPLEMENTATION OF STACKS IN
DATA STRUCTURES USING TWO LINKED-LIST
DATA STRUCTURES THAT ARE AN
ARRAY AND A LINKED LIST.
ARRAY
IN ARRAY IMPLEMENTATION, THE STACK IS FORMED USING AN ARRAY. ALL THE
OPERATIONS ARE PERFORMED USING ARRAYS. YOU WILL SEE HOW ALL
OPERATIONS CAN BE IMPLEMENTED ON THE stack in data structures using an array data
structure.
LINKED-LIST
EVERY NEW ELEMENT IS INSERTED AS A TOP ELEMENT IN THE
linked list implementation of stacks in data structures. That means every newly inserted element is
pointed to the top. Whenever you want to remove an element from the stack, remove the node indicated
by the top, by moving the top to its previous node in the list.
Some Applications of a stack in real life
are:

Undo/Redo button/operation in word processors Media playlist. To play previous and next song.

Forward-backward surfing in the browser.


Notifications ( latest appears first )

History of visited websites.


Floors in a Building

Message logs and all messages you get are arranged in a stack. Loading and unloading the car
Advantages of Stack Disadvantages of Stack
• Easy implementation: Stack data structure is easy to implement • Limited capacity: Stack data structure has a limited capacity as it
using arrays or linked lists, and its operations are simple to can only hold a fixed number of elements. If the stack becomes
understand and implement. full, adding new elements may result in stack overflow, leading to
• Fast access time: Stack data structure provides fast access time the loss of data.
for adding and removing elements as the elements are added and • Memory management: Stack data structure uses a
removed from the top of the stack. contiguous block of memory, which can result in memory
• Helps in function calls: Stack data structure is used to store fragmentation if elements are added and removed
function calls and their states, which helps in the efficient frequently.
implementation of recursive function calls. • Stack overflow and underflow: Stack data structure can
• Supports backtracking: Stack data structure supports result in stack overflow if too many elements are pushed
backtracking algorithms, which are used in problem-solving to
onto the stack, and it can result in stack underflow if too
explore all possible solutions by storing the previous states.
many elements are popped from the stack.
• Enables undo/redo operations: Stack data structure is used to
enable undo and redo operations in various applications like text
• Recursive function calls limitations: While stack data
editors, graphic design tools, and software development structure supports recursive function calls, too many
environments. recursive function calls can lead to stack overflow,
resulting in the termination of the program.
Key Points
• Essential to computer science, data structures allow for
the effective arrangement and manipulation of data.
Stacks are one type of these structures that enable push
(adding an element), pop (removing the top element),
and peek (viewing the top element) operations. Stacks
also follow the Last In, First Out (LIFO) principle.
Arrays are restricted in terms of resizing and
insertion/deletion, but they provide a fixed-size
sequential collection of elements with constant-time
access via index. In contrast, linked lists are made up of
nodes that can dynamically expand or contract. Each
node contains data as well as a reference to the node
after it. This allows for rapid insertion and deletion, but
traversal may result in slower access times.
Choosing the right data structure
The type of data you're working with, the operations you'll do most frequently, and the
efficiency needs of your application are all important considerations when selecting the
appropriate data structure. And for instance, a linked list would be a better option if you
require rapid insertion and deletion, but a hash table or binary search tree might be
more applicable for speedy element retrieval. It all comes down to matching the
strengths of various data structures with the features of your data and processes.
Importance in Algorith Design and Software
development
• Algorithm design is crucial in software
development because it provides a step-by-step
process for solving problems and performing tasks.
• Can greatly improve the performance and speed of
software, making it run smoothly and reliably.
• By following principles such as breaking down
problems into smaller sub-problems and using
appropriate data structures and algorithms,
developers can create software that performs well
and meets user needs.
• Understanding algorithm design is also important
for developing effective and optimized code.
Do you have any
questions?
Tell it to us! We hope you
learned something new.
END
Stacks
Prepared by:
Kimberly Kate Salunga
Mikaela Valencia
Michelle Medina
Jan Vincent Mercado
Clark Vergara

You might also like