Intro To Data Structures and Algorithms
Intro To Data Structures and Algorithms
and algorithms
RP: Imran Latif
imranlatif@cuilahore.edu.pk
Data structures
What is Data Structure?
“A systematic way of storing and organizing data”
K 1
Loc 1
MAX DATA[1]
Write
Is K > N? Loc, MAX
Is MAX
<DATA[K] STOP
MAX = DATA[K]
Loc = K
Binary search: To find a key from an array A in ascending
order
found = false; low = 0; high = N – 1;
while (( ! found) && ( low <= high))
{