bsc

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

root / semester_2 / algorithms / algo_005.md

algo_005.md (467B)


      1 # algo_005
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to insert a node at the end of the list.
      6 
      7 ## Algorithm
      8 ```
      9 procedure insertEnd(head)
     10 begin
     11     nptr ← getnode();
     12     write("Enter info: ");
     13     read(val);
     14     info(nptr) ← val;
     15     if(head = NULL)
     16         head ← nptr;
     17     else
     18         ptr ← head;
     19         while(next(ptr) ≠ NULL)
     20             ptr ← next(ptr);
     21         end while
     22         next(ptr) ← nptr;
     23     endif
     24     return(head);
     25 end procedure
     26 ```
© 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