English

Write an algorithm for Traversing Linear Array. - Computer Science 1

Advertisements
Advertisements

Question

Write an algorithm for Traversing Linear Array.

Short Answer
Advertisements

Solution

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)
  Is there an error in this question or solution?
2017-2018 (March)

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×