0% found this document useful (0 votes)
2 views3 pages

Data Structure Algorithms Overview

The document outlines key algorithms and processes for data structures, including searching (linear and binary), sorting (bubble, selection, insertion, merge, quick, and heap sort), and operations on linked lists, stacks, queues, trees, graphs, and strings. Each section provides step-by-step instructions for performing these operations. The notes serve as a quick reference for understanding fundamental data structure algorithms.

Uploaded by

Melancia G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Data Structure Algorithms Overview

The document outlines key algorithms and processes for data structures, including searching (linear and binary), sorting (bubble, selection, insertion, merge, quick, and heap sort), and operations on linked lists, stacks, queues, trees, graphs, and strings. Each section provides step-by-step instructions for performing these operations. The notes serve as a quick reference for understanding fundamental data structure algorithms.

Uploaded by

Melancia G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DATA STRUCTURE ALGORITHMS – PROCESS STEPS (Compressed Notes)

1. SEARCHING
Linear Search:
- Start at index 0
- Compare key with each element
- If match, return index
- Else return NOT FOUND

Binary Search:
- low=0, high=n-1
- mid=(low+high)/2
- If key==mid → return
- If key<mid → high=mid-1
- Else low=mid+1

2. SORTING
Bubble Sort:
- Compare adjacent elements
- Swap if needed
- Repeat

Selection Sort:
- Find minimum
- Swap with current index

Insertion Sort:
- Take key
- Shift larger elements right
- Insert key

Merge Sort:
- Divide into halves
- Sort halves
- Merge

Quick Sort:
- Choose pivot
- Partition
- Recursively sort parts

Heap Sort:
- Build heap
- Swap root with end
- Heapify

3. LINKED LIST
Insert:
- Create node
- Adjust pointers

Delete:
- Find node
- Adjust prev pointer
- Delete node

Reverse:
- prev=NULL
- Reverse links

4. STACK
Push:
- Check overflow
- Insert

Pop:
- Check underflow
- Remove top

Infix → Postfix:
- Scan
- Push operators
- Output operands

Postfix Evaluation:
- Push operands
- Pop two values for operator

5. QUEUE
Enqueue:
- Check full
- rear++

Dequeue:
- Check empty
- front++

6. TREES
Traversals:
- Inorder: L R R
- Preorder: R L R
- Postorder: L R R
- Level-order: queue

BST Insert:
- Compare
- Insert at NULL

BST Delete:
- 0,1,2 child cases

AVL Insert:
- BST insert
- Check balance
- Rotate
Heap Insert:
- Insert at end
- Percolate up

7. GRAPH
BFS:
- Queue
- Visit neighbors

DFS:
- Recursively visit nodes

Dijkstra:
- Pick min distance
- Update neighbors

Kruskal:
- Sort edges
- Add non-cyclic edges

Prim:
- Start with any node
- Add smallest connecting edge

8. STRING
Naive:
- Slide window
- Compare

KMP:
- Build LPS
- Use LPS for jumps

Rabin-Karp:
- Hash pattern
- Compare sliding hash

You might also like