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

algo_042.md (424B)


      1 # algo_042
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to enqueue an element into a circular queue using linked representation.
      6 
      7 ## Algorithm
      8 ```
      9 procedure enqueue(cq, val)
     10 begin
     11     ptr ← getNode();
     12     info(ptr) ← val;
     13     next(ptr) ← ptr;
     14     if (cq = NULL) then
     15         cq ← ptr;
     16     else
     17         next(ptr) ← next(cq);
     18         next(cq) ← ptr;
     19         cq ← ptr;
     20     endif
     21     return(cq);
     22 end procedure
     23 ```