SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
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 :
Any Questions ?!
Thank You 

Weitere ähnliche Inhalte

Was ist angesagt?

DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEshubhamrohiwal6
 
Data Structure Using C
Data Structure Using CData Structure Using C
Data Structure Using Ccpjcollege
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithmsVinayKumarV16
 
data structure
data structuredata structure
data structurehashim102
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureVivek Kumar Sinha
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2Self-Employed
 
Slide 1.-datastructure
Slide 1.-datastructureSlide 1.-datastructure
Slide 1.-datastructureMinhaz Leo
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 
Data structures & algorithms lecture 3
Data structures & algorithms lecture 3Data structures & algorithms lecture 3
Data structures & algorithms lecture 3Poojith Chowdhary
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)Elavarasi K
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Balwant Gorad
 
Introduction to stack
Introduction to stack Introduction to stack
Introduction to stack Kavya Shree
 
Data structures Lecture no. 2
Data structures Lecture no. 2Data structures Lecture no. 2
Data structures Lecture no. 2AzharIqbal710687
 
Data structures Lecture no.3
Data structures Lecture no.3Data structures Lecture no.3
Data structures Lecture no.3AzharIqbal710687
 
Data structures lectures no 1
Data structures lectures no 1Data structures lectures no 1
Data structures lectures no 1AzharIqbal710687
 
List Data Structure
List Data StructureList Data Structure
List Data StructureZidny Nafan
 

Was ist angesagt? (20)

DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
 
Data Structure Using C
Data Structure Using CData Structure Using C
Data Structure Using C
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithms
 
data structure
data structuredata structure
data structure
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
 
Slide 1.-datastructure
Slide 1.-datastructureSlide 1.-datastructure
Slide 1.-datastructure
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
Data structure
Data structureData structure
Data structure
 
Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)
 
Data structures & algorithms lecture 3
Data structures & algorithms lecture 3Data structures & algorithms lecture 3
Data structures & algorithms lecture 3
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
Data struters
Data strutersData struters
Data struters
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
 
Introduction to stack
Introduction to stack Introduction to stack
Introduction to stack
 
Data structures Lecture no. 2
Data structures Lecture no. 2Data structures Lecture no. 2
Data structures Lecture no. 2
 
Data structures Lecture no.3
Data structures Lecture no.3Data structures Lecture no.3
Data structures Lecture no.3
 
Data structures lectures no 1
Data structures lectures no 1Data structures lectures no 1
Data structures lectures no 1
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
R Datatypes
R DatatypesR Datatypes
R Datatypes
 

Ähnlich wie Data Structures Explained: Queues, Stacks, Trees, Lists, Arrays & More

1 list datastructures
1 list datastructures1 list datastructures
1 list datastructuresNguync91368
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxUsriDevi1
 
Data Structure
Data Structure Data Structure
Data Structure Ibrahim MH
 
chapter three ppt.pptx
chapter three ppt.pptxchapter three ppt.pptx
chapter three ppt.pptxselemonGamo
 
DS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringDS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringRAJASEKHARV8
 
46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.pptRizwanBasha12
 
data structure details of types and .ppt
data structure details of types and .pptdata structure details of types and .ppt
data structure details of types and .pptpoonamsngr
 
Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introductionSugandh Wafai
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyMalikireddy Bramhananda Reddy
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Tutort Academy
 
data structure programing language in c.ppt
data structure programing language in c.pptdata structure programing language in c.ppt
data structure programing language in c.pptLavkushGupta12
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEVenugopalavarma Raja
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxmexiuro901
 
Application of Data structure
Application of Data structureApplication of Data structure
Application of Data structureDeepika051991
 
C++ Data Structure PPT.pptx
C++ Data Structure PPT.pptxC++ Data Structure PPT.pptx
C++ Data Structure PPT.pptxMukesh Thakur
 

Ähnlich wie Data Structures Explained: Queues, Stacks, Trees, Lists, Arrays & More (20)

UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
1 list datastructures
1 list datastructures1 list datastructures
1 list datastructures
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
 
Data Structure
Data Structure Data Structure
Data Structure
 
chapter three ppt.pptx
chapter three ppt.pptxchapter three ppt.pptx
chapter three ppt.pptx
 
1597380885789.ppt
1597380885789.ppt1597380885789.ppt
1597380885789.ppt
 
DS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringDS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and Engineering
 
46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt
 
data structure details of types and .ppt
data structure details of types and .pptdata structure details of types and .ppt
data structure details of types and .ppt
 
Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introduction
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...
 
data structure programing language in c.ppt
data structure programing language in c.pptdata structure programing language in c.ppt
data structure programing language in c.ppt
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptx
 
Chapter 5 ds
Chapter 5 dsChapter 5 ds
Chapter 5 ds
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 
Application of Data structure
Application of Data structureApplication of Data structure
Application of Data structure
 
C++ Data Structure PPT.pptx
C++ Data Structure PPT.pptxC++ Data Structure PPT.pptx
C++ Data Structure PPT.pptx
 

Kürzlich hochgeladen

Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Osopher
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptxAneriPatwari
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 

Kürzlich hochgeladen (20)

INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...
 
Chi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical VariableChi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical Variable
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptx
 
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 

Data Structures Explained: Queues, Stacks, Trees, Lists, Arrays & More

  • 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.
  • 20.
  • 21.
  • 22.