SlideShare a Scribd company logo
1 of 25
Introduction to
Data Structure
What is Data Structure?
 A data structure is a particular way of
storing and organizing data in a computer
so that it can be used efficiently.
 They provide a means to manage large
amounts of data efficiently, such as large
databases.
 Data are simply values or set of values
and Database is organized collection of
data.
Department of CSE 2
What is Data Structure? (…contd)
A data structure is a logical and
mathematical model of a particular
organization of data.
The choice of particular data structure
depends upon following consideration:
1.It must be able to represent the inherent
relationship of data in the real world.
2.It must be simple enough so that it can be
processed efficiently as and when
necessary.
Department of CSE 3
THE STUDY OF DATA
STRUCTURE INCLUDE:
 Logical description of data structure
 Implementation of data structure
 Quantitative analysis of data structure, this include
amount of memory, processing time
Department of CSE 4
Classification of Data Structure
Data Structures
Department of CSE 5
Primitive Data Structures Non-Primitive Data Structures
Integer Real Character Boolean Linear Data
Structures
Non -Linear
Data Structures
Arrays
Stack
s
Linked
List
Queues
Trees
Graphs
Classification (contd..)
A data structure can be broadly classified into
 Primitive data structure
 Non-primitive data structure
Primitive data structure :-The data structures, that are
directly operated upon by machine level instructions i.e.
the fundamental data types such as int, float in case of
‘c’ are known as primitive data structures.
Non- Primitive data structure :-These are more complex
data structures. These data structures are derived from
the primitive data structures.
Department of CSE 6
Classification (contd..)
Non-Primitive Data Structures can be further divided into
two categories:
 Linear Data Structures
 Non-Linear Data Structures.
Linear Data Structures:-In linear data structures, data
elements are organized sequentially and therefore they
are easy to implement in the computer’s memory. E.g.
Arrays.
 Non-Linear Data Structures:-In nonlinear data
structures, a data element can be attached to several
other data elements to represent specific relationships
that exist among them. E.g. Graphs
Department of CSE 7
Array & Linked List
Department of CSE 8
[0] [1] [2]
A B C
Array
linked
A B C
Linked list
Linked lists are unbounded
(maximum number of items limited only by memory)
node
Stack
 Stack
◦ New nodes can be added and removed only at the top
◦ Similar to a pile of dishes
◦ Last-in, first-out (LIFO)
 push
◦ Adds a new node to the top of the stack
 pop
◦ Removes a node from the top
Department of CSE 9
Stack
 A stack is a list in which insertion and
deletion take place at the same end
◦ This end is called top
◦ The other end is called bottom.
Department of CSE 10
Queue
 Queue
◦ Similar to a supermarket checkout line
◦ First-in, first-out (FIFO)
◦ Nodes are removed only from the head
◦ Nodes are inserted only at the tail
 Insert and remove operations
◦ Enqueue (insert) and dequeue (remove)
Department of CSE 11
The Queue Operations
 A queue is like a
line of people
waiting for a bank
teller. The queue
has a front and a
rear.
Department of CSE 12
$ $
Front(Removal)
Rear(insertion)
Walking out
Tree
A tree T is a finite non empty set of
elements. One of these elements is called
the root, and the remaining elements, if
any, are portioned into trees, which are
called the sub trees of T.
Department of CSE 13
Tree (example)
Department of CSE 14
node
Graph
 A graph is defined as:
“Graph G is a ordered set (V,E), where V(G)
represent the set of elements, called vertices, and
E(G) represents the edges between these
vertices.”
 Graphs can be
◦ Undirected
◦ Directed
Department of CSE 15
Graph
Figure shows a sample graph
V(G)={v1,v2,v3,v4,v5}
E(G)={e1,e2,e3,e4,e5}
Department of CSE 16
v1
v5
v4
v2 v3
e2
e1
e5
e4
e3
Fig . (a) Undirected Graph
Graph
Department of CSE 17
v1
v5
v4
v2 v3
e2
e1
e5
e4
e3
Fig. (b) Directed Graph
In directed graph, an edge is represented by an ordered pair (u,v) (i.e.=(u,v)),
that can be traversed only from u toward v.
Data Structure Operations
Five major operations are associated with all data
structures.
i. Creation:- Initialization of the beginning.
ii. Insertion: - Insertion means adding new details
or new node into the data structure.
iii. Deletion: - Deletion means removing a node
from the data structure.
iv. Traversal: - Traversing means accessing each
node exactly once so that the nodes of a data
structure can be processed. Traversing is also
called as visiting.
v. Searching: - Searching means finding the
location of node for a given key value.
Department of CSE 18
Data Structure Operations(contd..)
 Apart from the four operations mentioned
above, there are two more operations
occasionally performed on data structures. They
are:
(a) Sorting: -Sorting means arranging the data in
a particular order.
(b) Merging: - Merging means joining two lists.
Department of CSE 19
A first look on ADTs
 Solving a problem involves processing
data, and an important part of the solution
is the efficient organization of the data
 In order to do that, we need to identify:
1. The collection of data items
2. Basic operation that must be performed
on them
Abstract Data Type (ADT)
 The word “abstract” refers to the fact
that the data and the basic operations
defined on it are being studied
independently of how they are
implemented
 We think about what can be done with
the data, not how it is done
Primitive Data Type vs ADT
Department of CSE 22
Some ADT’s
Some user defined ADT’s are
 Stacks
 Queues
Department of CSE 23
Stack ADT
We define a stack as an ADT as shown
below:
Department of CSE 24
Queue ADT
We define a queue as an ADT as shown
below:
Department of CSE 25

More Related Content

Similar to Introduction to Data Structure.pptx

Unit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data StructuresresUnit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data Structuresresamplopsurat
 
Chapter 1 - Introduction to Data Structure.ppt
Chapter 1 - Introduction to Data Structure.pptChapter 1 - Introduction to Data Structure.ppt
Chapter 1 - Introduction to Data Structure.pptNORSHADILAAHMADBADEL
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfAxmedcarb
 
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
 
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 structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdData structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdNimmi Weeraddana
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureadeel hamid
 
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
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureRai University
 
data structure
data structuredata structure
data structurehashim102
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its FundamentalsHitesh Mohapatra
 

Similar to Introduction to Data Structure.pptx (20)

Unit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data StructuresresUnit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data Structuresres
 
DSA - Copy.pptx
DSA - Copy.pptxDSA - Copy.pptx
DSA - Copy.pptx
 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
 
UNIT II.docx
UNIT II.docxUNIT II.docx
UNIT II.docx
 
Chapter 1 - Introduction to Data Structure.ppt
Chapter 1 - Introduction to Data Structure.pptChapter 1 - Introduction to Data Structure.ppt
Chapter 1 - Introduction to Data Structure.ppt
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
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
 
104333 sri vidhya eng notes
104333 sri vidhya eng notes104333 sri vidhya eng notes
104333 sri vidhya eng notes
 
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
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
Data structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdData structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pd
 
intr_ds.ppt
intr_ds.pptintr_ds.ppt
intr_ds.ppt
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
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 using c++
Data structure using c++Data structure using c++
Data structure using c++
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structure
 
data structure
data structuredata structure
data structure
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its Fundamentals
 

Recently uploaded

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Recently uploaded (20)

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 

Introduction to Data Structure.pptx

  • 2. What is Data Structure?  A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.  They provide a means to manage large amounts of data efficiently, such as large databases.  Data are simply values or set of values and Database is organized collection of data. Department of CSE 2
  • 3. What is Data Structure? (…contd) A data structure is a logical and mathematical model of a particular organization of data. The choice of particular data structure depends upon following consideration: 1.It must be able to represent the inherent relationship of data in the real world. 2.It must be simple enough so that it can be processed efficiently as and when necessary. Department of CSE 3
  • 4. THE STUDY OF DATA STRUCTURE INCLUDE:  Logical description of data structure  Implementation of data structure  Quantitative analysis of data structure, this include amount of memory, processing time Department of CSE 4
  • 5. Classification of Data Structure Data Structures Department of CSE 5 Primitive Data Structures Non-Primitive Data Structures Integer Real Character Boolean Linear Data Structures Non -Linear Data Structures Arrays Stack s Linked List Queues Trees Graphs
  • 6. Classification (contd..) A data structure can be broadly classified into  Primitive data structure  Non-primitive data structure Primitive data structure :-The data structures, that are directly operated upon by machine level instructions i.e. the fundamental data types such as int, float in case of ‘c’ are known as primitive data structures. Non- Primitive data structure :-These are more complex data structures. These data structures are derived from the primitive data structures. Department of CSE 6
  • 7. Classification (contd..) Non-Primitive Data Structures can be further divided into two categories:  Linear Data Structures  Non-Linear Data Structures. Linear Data Structures:-In linear data structures, data elements are organized sequentially and therefore they are easy to implement in the computer’s memory. E.g. Arrays.  Non-Linear Data Structures:-In nonlinear data structures, a data element can be attached to several other data elements to represent specific relationships that exist among them. E.g. Graphs Department of CSE 7
  • 8. Array & Linked List Department of CSE 8 [0] [1] [2] A B C Array linked A B C Linked list Linked lists are unbounded (maximum number of items limited only by memory) node
  • 9. Stack  Stack ◦ New nodes can be added and removed only at the top ◦ Similar to a pile of dishes ◦ Last-in, first-out (LIFO)  push ◦ Adds a new node to the top of the stack  pop ◦ Removes a node from the top Department of CSE 9
  • 10. Stack  A stack is a list in which insertion and deletion take place at the same end ◦ This end is called top ◦ The other end is called bottom. Department of CSE 10
  • 11. Queue  Queue ◦ Similar to a supermarket checkout line ◦ First-in, first-out (FIFO) ◦ Nodes are removed only from the head ◦ Nodes are inserted only at the tail  Insert and remove operations ◦ Enqueue (insert) and dequeue (remove) Department of CSE 11
  • 12. The Queue Operations  A queue is like a line of people waiting for a bank teller. The queue has a front and a rear. Department of CSE 12 $ $ Front(Removal) Rear(insertion) Walking out
  • 13. Tree A tree T is a finite non empty set of elements. One of these elements is called the root, and the remaining elements, if any, are portioned into trees, which are called the sub trees of T. Department of CSE 13
  • 15. Graph  A graph is defined as: “Graph G is a ordered set (V,E), where V(G) represent the set of elements, called vertices, and E(G) represents the edges between these vertices.”  Graphs can be ◦ Undirected ◦ Directed Department of CSE 15
  • 16. Graph Figure shows a sample graph V(G)={v1,v2,v3,v4,v5} E(G)={e1,e2,e3,e4,e5} Department of CSE 16 v1 v5 v4 v2 v3 e2 e1 e5 e4 e3 Fig . (a) Undirected Graph
  • 17. Graph Department of CSE 17 v1 v5 v4 v2 v3 e2 e1 e5 e4 e3 Fig. (b) Directed Graph In directed graph, an edge is represented by an ordered pair (u,v) (i.e.=(u,v)), that can be traversed only from u toward v.
  • 18. Data Structure Operations Five major operations are associated with all data structures. i. Creation:- Initialization of the beginning. ii. Insertion: - Insertion means adding new details or new node into the data structure. iii. Deletion: - Deletion means removing a node from the data structure. iv. Traversal: - Traversing means accessing each node exactly once so that the nodes of a data structure can be processed. Traversing is also called as visiting. v. Searching: - Searching means finding the location of node for a given key value. Department of CSE 18
  • 19. Data Structure Operations(contd..)  Apart from the four operations mentioned above, there are two more operations occasionally performed on data structures. They are: (a) Sorting: -Sorting means arranging the data in a particular order. (b) Merging: - Merging means joining two lists. Department of CSE 19
  • 20. A first look on ADTs  Solving a problem involves processing data, and an important part of the solution is the efficient organization of the data  In order to do that, we need to identify: 1. The collection of data items 2. Basic operation that must be performed on them
  • 21. Abstract Data Type (ADT)  The word “abstract” refers to the fact that the data and the basic operations defined on it are being studied independently of how they are implemented  We think about what can be done with the data, not how it is done
  • 22. Primitive Data Type vs ADT Department of CSE 22
  • 23. Some ADT’s Some user defined ADT’s are  Stacks  Queues Department of CSE 23
  • 24. Stack ADT We define a stack as an ADT as shown below: Department of CSE 24
  • 25. Queue ADT We define a queue as an ADT as shown below: Department of CSE 25