bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / algorithms / algo_038.md

algo_038.md (445B)


      1 # algo_038
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to enqueue (circular queue)
      6 
      7 ## Algorithm
      8 ```
      9 procedure enqueue(rear, Qsize, front, Q[], val)
     10 begin
     11     if((rear + 1) % Qsize = font)
     12         write("Queue full, insertion can't be done.");
     13     else
     14         if(front = -1)
     15             front ← 0;
     16         endif
     17         rear ← (rear + 1) % Qsize;
     18         Q[rear] ← val;
     19         write("Inserted element", val);
     20     endif
     21 end procedure
     22 ```
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror