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

algo_041.md (491B)


      1 # algo_041
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to dequeue an element from a linear queue using linked representation.
      6 
      7 ## Algorithm
      8 ```
      9 procedure dequeue(front, rear)
     10 begin
     11     if (front = NULL and rear = NULL) then
     12         write("Queue empty, deletion not possible.");
     13     else if (front = rear) then
     14         delete(front);
     15         front ← NULL;
     16         rear ← NULL;
     17     else
     18         ptr ← front;
     19         front ← next(ptr);
     20         delete(ptr);
     21     endif
     22 end procedure
     23 ```