Data Structure All Algorithm
Data Structure All Algorithm
Stack
Queue
Sorting
Algorithm of Bubble sort
(Bubble Sort) BUBBLE (DATA, N)
Here DATA is an array with N element. This algorithm sorts the elements in
DATA.
1. Repeat Steps 2 and 3 for K= 1 too N-1.
2. [initializes pass pointer PTR ]. Set PTR = 1.
3. Repeat While PTR <= N-K : [Executes pass]
a) if DATA[PTR] > DATA[PTR]+1;
Interchange DATA[PTR] and DATA[PTR]+1;
End of if structure.
b) Set PTR=PTR+1;
[end of inner loop]
[end of Step 1 outer loop]
4. Exit.
Algorithm of Insertion sort
Sreach
Algorithm of Binary Search
else
last=mid-1;
mid=( first + last)/2;
1. Declaration A[ ], X.
2. c=0 ;
3. if (A[ c] = = X)
print “ Found”
4. if(c = = 0)
print “Not Found”
5. Exit.
1 D & 2D Array
1D Array
1. Set item=LA[K]
2. Loop for I= K to N-1;
3. Set LA[I]=LA[I+1]
4. End loop
5. N=N-1;
6. Exit;
2D Array / Matrix
Al Islam - 2024