bsc

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

root / semester_2 / algorithms / algo_040.md

algo_040.md (450B)


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