bsc

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

root / semester_2 / algorithms / algo_001.md

algo_001.md (407B)


      1 # algo_001
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to insert a node at the beginning.
      6 
      7 ## Algorithm
      8 ```
      9 procedure insert_begin(head)
     10 begin
     11     ptr ← get_node();
     12     print("Enter the value");
     13     read(val);
     14     info(ptr) ← val;
     15     next(ptr) ← NULL;
     16     if(head = NULL) 
     17         head ← ptr;
     18     else
     19         next(ptr) ← head;
     20         head ← ptr;
     21     endif
     22     return(head);
     23 end procedure
     24 ```
© 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