data structure
DESCRIPTION
TRANSCRIPT
![Page 1: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/1.jpg)
Wel Come to Data Structure class
Junaid khanVisiting Lecturer University of Peshawar
![Page 2: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/2.jpg)
DATA STRUCTURE AND ITS TYPES
![Page 3: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/3.jpg)
Data StructureIt is a logical way of storing data and it also define mechanism of
retrieve data.
![Page 4: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/4.jpg)
What are Data Structures? Data may be organized in many different ways. A Data Structure is an arrangement of data in
a computer’s memory or on a disk. The logical or mathematical model of a
particular organization of a data is called Data Structures.
The choice of a data model depends on two consideration:
1) It must be rich enough in structure to mirror the actual relationships of the data in the real world.
2) The structure should be simple enough that one can effectively process the data when necessary.
![Page 5: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/5.jpg)
Types of Data Structure
DATA STRUCTURE
NON LINEARLINEAR
![Page 6: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/6.jpg)
Data Structure Operation
The data appearing in data structures are processed by means of operations. The following are operations are major operations:
a) Traversing: Accessing each record exactly once so that certain items in the record may be processed.
b) Searching: Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions.
c) Inserting: Adding a new record to the structure.d) Deleting: Removing a record from the structure.
Following two are special operations:
a) Sorting: Arranging the records in some logical order.
b) Merging: Combining the records in two different sorted files into a single sorted file.
![Page 7: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/7.jpg)
What are Algorithms?An algorithm is a well-defined list of steps for solving a particular problem.Algorithms manipulate the data present in data structures in various ways, such as searching for a particular data item and sorting the data.Flowcharts are pictorial representations of the algorithms.Properties/ characteristics of the algorithm:
a) Finiteness: Total number of steps used in an algorithm should be finite.
b) Definiteness: Each step of algorithm must be clear and unambiguous.
c) Effectiveness: Every step must be basic and essential.
d) Input/output: The algorithm must accept zero or more input and must produce at least on output.
![Page 8: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/8.jpg)
Linear Data Structure1.Array2.Stack3.Queue4.Linked List
![Page 9: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/9.jpg)
1.ArrayAn array is a collection of homogeneous type of data elements.An array is consisting of a collection of elements .
![Page 10: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/10.jpg)
Operation Performed On Array1.Traversing2.Search3.Insertion4.Deletion5.Sorting6.Merging
![Page 11: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/11.jpg)
Representation of array in memory1
2
3
4
5
![Page 12: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/12.jpg)
Array Representation
![Page 13: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/13.jpg)
2.StackA Stack is a list of elements in which an element may be inserted or deleted at one end which is known as TOP of the stack.
![Page 14: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/14.jpg)
Operation Performed on Stack Push: add an element in stack Pop: remove an element in stack
![Page 15: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/15.jpg)
Representation of Stack
EEE TOP
DDD
CCC
BBB
AAA
![Page 16: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/16.jpg)
Stack Representation
![Page 17: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/17.jpg)
3.QueueA queue is a linear list of element in which insertion can be done at one end which is known as front and deletion can be done which is known as rear.
![Page 18: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/18.jpg)
Operation Performed On QueueInsertion : add a new element in queueDeletion: Removing an element in queue
![Page 19: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/19.jpg)
Representation of Queue
55 65 75
![Page 20: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/20.jpg)
Queue Representation
![Page 21: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/21.jpg)
4.Linked ListA Linked list is a linear collection of data elements .It has two part one is info and other is link part.info part gives information and link part is address of next node
![Page 22: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/22.jpg)
Operation Performed on Linked List1.Traversing2.Searching3.Insertion4.Deletion
![Page 23: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/23.jpg)
Linked Representation
![Page 24: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/24.jpg)
2.Non Linear1.Tree2.Graph
![Page 25: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/25.jpg)
1.TreeIn computer science, a tree is a widely-used data structure that emulates a hierarchical tree structure with a set of linked nodes.
![Page 26: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/26.jpg)
Operation On Tree1.Insertion2.Deletion3.Searching
![Page 27: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/27.jpg)
Tree Representation
![Page 28: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/28.jpg)
2.GraphA graph data structure may also associate to each edge some edge value, such as a symbolic label or a numeric attribute (cost, capacity, length, etc.).
![Page 29: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/29.jpg)
Operation Performed Graph1.Searching2.Insertion3.Deletion
![Page 30: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/30.jpg)
Graph Representation
![Page 31: Data structure](https://reader033.vdocuments.us/reader033/viewer/2022061210/54907e1ab47959a8618b45c3/html5/thumbnails/31.jpg)
THANKS