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_007.md

algo_007.md (384B)


      1 # algo_007
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to search an element from a linked list.
      6 
      7 ## Algorithm
      8 ```
      9 procedure search(head, key)
     10 begin
     11     isFound ← false;
     12     ptr ← head;
     13     while(ptr ≠ NULL)
     14         if(info(ptr) = key)
     15             isFound ← true;
     16             break;
     17         endif
     18         ptr ← next(ptr);
     19     end while
     20     return(isFound);
     21 end procedure
     22 ```