SlideShare a Scribd company logo
Data Structure
ENG. YOUSSEF ABDELHAKIM
Agenda:


Abstract Data Type (ADT).



What is the Data Structure ?



Data Structure examples :



Queue.



Stack.



Binary Search Tree(BST).



Lists.



Arrays.



Linked List.



Graph.



Hashing.
Abstract Data Type (ADT).


An ADT is fully described by a domain of values
together with a set of operations to manipulate
these values.



Ex: point = {{(a,b) : a, b belongs to R, {create, translate, rotate,
scale} }



Ex: set = { { a collection of well defined and distinct objects} {isEmpty,
numElements, union, intersection,} }
What is the Data Structure?


A data structure is one way of implementing an ADT.



The way in which the data is organized affects the
performance of a program for different tasks.



Computer programmers decide which data structures
to use based on the nature of the data and the
processes that need to be performed on that data.



An ADT can have several different data structures.



A set might be implemented using a sorted dynamic
array, or using a binary search tree.
Data Structure examples :
Queue :
A

Queue is a list-like structure where elements
can be inserted into only one end and
removed from the other end in a First In First
Out (FIFO) fashion.
A

queue is a good data structure to use for
storing things that need to be kept in order,
such as a set of documents waiting to be
printed on a network printer.
Queue Applications :


Printing Job Management



Packet Forwarding in Routers



Message queue in Windows



I/O buffer
Operations on the queue :


enqueue




dequeue




check whether the queue is full or not

size




check whether the queue is empty or not

isFull




remove a item from the front

isEmpty




add a new item at the rear

return the number of items in the queue

peek


return the front item
Stack :


A Stack is a list-like structure where
elements can be inserted or removed from
only one end in a Last In First Out (LIFO)
fashion.



An important application we make it with
stack : Undo / Redo .



Some languages, like LISP and Python, do not call
for stack implementations, since push and pop
functions are available for any list.
Last-in First-out (LIFO)
Push A, B, C

A

A

Pop C, B, A

B
A

B
A

C
B
A

The last one
pushed in is the
first one popped
out! (LIFO)

When we push entries
onto the stack and then
pop them out one by one,
we will get the entries in
reverse order.
Stack Implementation :
interface Stack
{
 void push(Object x)
 Object pop()
 Object peek()
 boolean isEmpty()
 int size()
}
Binary Search Tree (BST) :


A binary search tree is another
commonly used data structure. It is
organized like an upside down
tree.



Each spot on the tree, called a
node, holds an item of data along
with a left pointer and a right
pointer.



A binary tree is a good data
structure to use for searching
sorted data.
Lists :


A list is an ordered set of data.
It is often used to store objects
that are to be processed
sequentially.



A list can be used
to create a queue.
Arrays :


An array is an indexed set of
variables, such as dancer[1],
dancer[2], dancer[3],… It is like a
set of boxes that hold things.



An array is a set of
variables that each
store an item.
Arrays and Lists :
 You can see the difference between
arrays and lists when you delete items.
Arrays and Lists
 In a list, the missing spot is
filled in when something is
deleted but in the In
array, an empty variable
is left behind when
something is deleted.
Linked List :
A linked list is a collection of data in
which each element contains the
location of the next element—that is,
each element contains two parts: data
and link. The name of the list is the
same as the name of this pointer
variable.
Operations on linked lists :


The same operations we defined for an array can be applied to a linked list.



Searching a linked list :



Since nodes in a linked list have no names, we use two pointers, pre (for
previous) and cur (for current). At the beginning of the search, the pre
pointer is null and the cur pointer points to the first node. The search
algorithm moves the two pointers together towards the end of the list.
Figure 11.13 shows the movement of these two pointers through the list in
an extreme case scenario: when the target value is larger than any value in
the list.
Graphs:
List, BST, and Hash-Tables are used
for generic storage and search.
Graphs are useful to represent
relationships between data items.
Examples:
 Modeling connectivity in
computer and communications
networks.
 Representing a road map.
 Modeling flow capacities in
transportation networks.
 Modeling family relationships
and business or military
organizations.
Hashing :
General Data structures
General Data structures
General Data structures
Any Questions ?!
Thank You 

More Related Content

PPTX
Presentation on Data Structure
PPT
Intro ds
PPTX
Data structure and its types.
PPTX
Data structure & its types
PDF
Datastructureitstypes
PPTX
Introduction to data structure
PDF
Datastructure 110410094008-phpapp02
PPTX
Data structure and its types
Presentation on Data Structure
Intro ds
Data structure and its types.
Data structure & its types
Datastructureitstypes
Introduction to data structure
Datastructure 110410094008-phpapp02
Data structure and its types

What's hot (20)

PPTX
DATA STRUCTURE IN C LANGUAGE
PDF
Introduction of data structures and algorithms
PPT
data structure
PPTX
Introduction to data structure
PPT
Abstract data types (adt) intro to data structure part 2
PPTX
Slide 1.-datastructure
PPT
Lecture 1 data structures and algorithms
PDF
Data structure
PPTX
Computer Science-Data Structures :Abstract DataType (ADT)
PPT
Data structures & algorithms lecture 3
PPTX
Data Structures (CS8391)
PPT
Data struters
PDF
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
PPTX
Introduction to stack
PPTX
Data structures Lecture no. 2
PPTX
Data structures Lecture no.3
PPTX
Data structures lectures no 1
PPT
List Data Structure
PPTX
R Datatypes
DATA STRUCTURE IN C LANGUAGE
Introduction of data structures and algorithms
data structure
Introduction to data structure
Abstract data types (adt) intro to data structure part 2
Slide 1.-datastructure
Lecture 1 data structures and algorithms
Data structure
Computer Science-Data Structures :Abstract DataType (ADT)
Data structures & algorithms lecture 3
Data Structures (CS8391)
Data struters
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Introduction to stack
Data structures Lecture no. 2
Data structures Lecture no.3
Data structures lectures no 1
List Data Structure
R Datatypes
Ad

Similar to General Data structures (20)

PPTX
DS Module 1.pptx
PPTX
DS Module 1.pptx
PPTX
TSAT Presentation1.pptx
PPT
Unit i(dsc++)
PPT
Unit 1.ppt
DOC
Data Structure
PPTX
01-Introduction of DSA-1.pptx
PPTX
Chapter 1 _edited.pptx.software engineering
PPTX
Chapter 1 _edited.pptx.software engineering
PPT
Data_Structure With C_LECTURE ONE PPT123
PPTX
data structures module I & II.pptx
PPTX
1.Introduction to Data Structures and Algorithms.pptx
PPT
intr_ds.ppt
PPTX
Data_structure.pptx
PPT
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
PPT
Lecture 1 - Overview of Data Structure .ppt
PPTX
Data structure Assignment Help
DOC
CS8391 Data Structures 2 mark Questions - Anna University Questions
PPTX
DATA STRUCTURE INTRODUCITON FULL NOTES.pptx
PPTX
ds bridge.pptx
DS Module 1.pptx
DS Module 1.pptx
TSAT Presentation1.pptx
Unit i(dsc++)
Unit 1.ppt
Data Structure
01-Introduction of DSA-1.pptx
Chapter 1 _edited.pptx.software engineering
Chapter 1 _edited.pptx.software engineering
Data_Structure With C_LECTURE ONE PPT123
data structures module I & II.pptx
1.Introduction to Data Structures and Algorithms.pptx
intr_ds.ppt
Data_structure.pptx
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
Lecture 1 - Overview of Data Structure .ppt
Data structure Assignment Help
CS8391 Data Structures 2 mark Questions - Anna University Questions
DATA STRUCTURE INTRODUCITON FULL NOTES.pptx
ds bridge.pptx
Ad

Recently uploaded (20)

PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Basic Mud Logging Guide for educational purpose
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Computing-Curriculum for Schools in Ghana
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Cell Structure & Organelles in detailed.
PPTX
Lesson notes of climatology university.
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Basic Mud Logging Guide for educational purpose
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Module 4: Burden of Disease Tutorial Slides S2 2025
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
human mycosis Human fungal infections are called human mycosis..pptx
Supply Chain Operations Speaking Notes -ICLT Program
VCE English Exam - Section C Student Revision Booklet
Computing-Curriculum for Schools in Ghana
GDM (1) (1).pptx small presentation for students
Microbial diseases, their pathogenesis and prophylaxis
Cell Structure & Organelles in detailed.
Lesson notes of climatology university.
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
2.FourierTransform-ShortQuestionswithAnswers.pdf

General Data structures

  • 2. Agenda:  Abstract Data Type (ADT).  What is the Data Structure ?  Data Structure examples :  Queue.  Stack.  Binary Search Tree(BST).  Lists.  Arrays.  Linked List.  Graph.  Hashing.
  • 3. Abstract Data Type (ADT).  An ADT is fully described by a domain of values together with a set of operations to manipulate these values.  Ex: point = {{(a,b) : a, b belongs to R, {create, translate, rotate, scale} }  Ex: set = { { a collection of well defined and distinct objects} {isEmpty, numElements, union, intersection,} }
  • 4. What is the Data Structure?  A data structure is one way of implementing an ADT.  The way in which the data is organized affects the performance of a program for different tasks.  Computer programmers decide which data structures to use based on the nature of the data and the processes that need to be performed on that data.  An ADT can have several different data structures.  A set might be implemented using a sorted dynamic array, or using a binary search tree.
  • 5. Data Structure examples : Queue : A Queue is a list-like structure where elements can be inserted into only one end and removed from the other end in a First In First Out (FIFO) fashion. A queue is a good data structure to use for storing things that need to be kept in order, such as a set of documents waiting to be printed on a network printer.
  • 6. Queue Applications :  Printing Job Management  Packet Forwarding in Routers  Message queue in Windows  I/O buffer
  • 7. Operations on the queue :  enqueue   dequeue   check whether the queue is full or not size   check whether the queue is empty or not isFull   remove a item from the front isEmpty   add a new item at the rear return the number of items in the queue peek  return the front item
  • 8. Stack :  A Stack is a list-like structure where elements can be inserted or removed from only one end in a Last In First Out (LIFO) fashion.  An important application we make it with stack : Undo / Redo .  Some languages, like LISP and Python, do not call for stack implementations, since push and pop functions are available for any list.
  • 9. Last-in First-out (LIFO) Push A, B, C A A Pop C, B, A B A B A C B A The last one pushed in is the first one popped out! (LIFO) When we push entries onto the stack and then pop them out one by one, we will get the entries in reverse order.
  • 10. Stack Implementation : interface Stack {  void push(Object x)  Object pop()  Object peek()  boolean isEmpty()  int size() }
  • 11. Binary Search Tree (BST) :  A binary search tree is another commonly used data structure. It is organized like an upside down tree.  Each spot on the tree, called a node, holds an item of data along with a left pointer and a right pointer.  A binary tree is a good data structure to use for searching sorted data.
  • 12. Lists :  A list is an ordered set of data. It is often used to store objects that are to be processed sequentially.  A list can be used to create a queue.
  • 13. Arrays :  An array is an indexed set of variables, such as dancer[1], dancer[2], dancer[3],… It is like a set of boxes that hold things.  An array is a set of variables that each store an item.
  • 14. Arrays and Lists :  You can see the difference between arrays and lists when you delete items.
  • 15. Arrays and Lists  In a list, the missing spot is filled in when something is deleted but in the In array, an empty variable is left behind when something is deleted.
  • 16. Linked List : A linked list is a collection of data in which each element contains the location of the next element—that is, each element contains two parts: data and link. The name of the list is the same as the name of this pointer variable.
  • 17. Operations on linked lists :  The same operations we defined for an array can be applied to a linked list.  Searching a linked list :  Since nodes in a linked list have no names, we use two pointers, pre (for previous) and cur (for current). At the beginning of the search, the pre pointer is null and the cur pointer points to the first node. The search algorithm moves the two pointers together towards the end of the list. Figure 11.13 shows the movement of these two pointers through the list in an extreme case scenario: when the target value is larger than any value in the list.
  • 18. Graphs: List, BST, and Hash-Tables are used for generic storage and search. Graphs are useful to represent relationships between data items. Examples:  Modeling connectivity in computer and communications networks.  Representing a road map.  Modeling flow capacities in transportation networks.  Modeling family relationships and business or military organizations.