bsc

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

algo_009.md (582B)


      1 # algo_009
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to insert a node after a special key value.
      6 
      7 ## Algorithm
      8 ```
      9 procedure insertAfterKey(head, key)
     10 begin
     11     current ← head;
     12     while(current ≠ NULL && info(current) ≠ key)
     13         current ← next(current);
     14     endwhile
     15     if(current ≠ NULL)
     16         write("Enter the value: ");
     17         read(val);
     18         newNode ← getnode();
     19         info(newNode) ← val;
     20         next(newNode) ← next(current);
     21         next(current) ← newNode;
     22     else
     23         write("Key not found in the list.");
     24     endif
     25 end procedure
     26 ```
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror