Data Structure

                                       DATA STRUCTURE AND ALGORITHM

Table of Content:

3. Data Structures. 5

Types of Data Structures. 5

3.1. Linear Data Structures. 5

3.2. Non-linear Data Structures. 5

3.1.1 Arrays. 5

3.1.1.1 Traverse Operation.. 7

3.1.1.2 Insertion Operation. 8

Insert Element at the Start of an Array. 8

Insert Element at the End of an Array. 9

Insert Element in Array at a Specific Position. 9

3.1.1.3 Deletion Operation. 11

Deletion at Start in Array. 12

Deletion from Position in Array. 13

Delete at end in Array. 14

3.1.1.4 Search Operation.. 16

Linear Search in C++.. 16

Binary Search in C++.. 17

3.1.1.5 Update Operation.. 18

3.1.2. Linked List. 19

3.1.2.1 Singly-linked List. 19

3.1.2.2 Doubly-Linked List. 21

3.1.2.3 Circular Singly Linked List. 23

3.1.2.4 Circularly Doubly Linked List. 25

3.1.3. Stack. 28

3.1.3.1 Stack using Arrays. 29

3.1.3.2 Stack using Linked List. 30

3.1.3.3 Infix To Postfix Conversion Using Stack. 34

3.1.4 Queue. 38

3.1.4.1 Queue using Arrays. 39

3.1.4.2 Queue using Linked List. 42

3.1.4.3 Circularly Queue Using Array. 47

3.1.4.4 Circularly Queue Using Linked list. 52

3.2.1 Trees. 55

3.2.1.1 Tree Terminology. 56

Root 57

Edge. 57

Path. 57

Parent Node. 58

Child Node. 58

Sibling.. 59

Degree. 59

Leaf Node. 60

Internal Node. 60

Subtree. 60

Levels. 61

Height 61

Depth. 62

Empty Tree. 62

3.2.1.2 Binary Trees. 62

3.2.1.3 Traversing Binary Trees. 63

3.2.1.4 Insertion in Binary Tree. 65

3.2.1.5           Binary Tree Deletion.. 67

The node to be deleted is a leaf node. 67

The node to be deleted has only one child. 67

The node to be deleted has two children. 68

3.2.1.6 Advantages of Binary Trees. 70

3.2.1.7 Complete Binary Trees. 70

3.2.1.8 Binary Search Trees. 73

Advantages of Binary search tree. 74

Example of creating a binary search tree. 74

1.      Searching in Binary search tree. 77

Algorithm to search an element in Binary search tree. 79

2.       Deletion in Binary Search tree. 79

3.       Insertion in Binary Search tree. 81

The complexity of the Binary Search tree. 81

Implementation of Binary search tree. 82


3.3.1 Graph. 84

3.3.1.1 What is a Graph?. 84

3.3.1.2 Types of Graphs. 85

Breadth-First Search. 85

Depth-first search. 87

Dijkstra's shortest path algorithm... 88

Cycle detection. 89

Minimum Spanning Tree. 90

Topological sorting.. 91

 

Conclusion.. 92

 

 

______________________________________________________________



Post a Comment

0 Comments

Close Menu