Advertisements
Advertisements
प्रश्न
Write an algorithm for Traversing Linear Array.
लघु उत्तर
Advertisements
उत्तर
Algorithm for traversing a linear array:
LA = linear array
LB = lower bound of an array
UB = upper bound of an array
PROCESS – operation of each element of LA
Step 1: [Initialize [counter]
Set K: = LB
Step 2: Repeat steps 3 and 4 while K ≤ UB
Step 3: [Visit element]
Apply PROCESS to LA[K]
Step 4: [Increase Counter]
Set K := K + 1
[End of step 2 loop]
Step 5: Exit
shaalaa.com
Basic Data Structures (Stack, Queue, Dequeue)
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
