bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_2 / algorithms / algo_020.md

algo_020.md (431B)


      1 # algo_020
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to search an element on a circular linked list.
      6 
      7 ## Algorithm
      8 ```
      9 procedure search(cl, key)
     10 begin
     11     found ← 0;
     12     if(cl)
     13         ptr ← next(cl);
     14         do
     15             if(key = info(ptr))
     16                 found ← 1;
     17                 break;
     18             endif
     19             ptr ← next(ptr);
     20         while(ptr ≠ next(cl));
     21     endif
     22     return(found);
     23 end procedure
     24 ```