bsc

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

algo_004.md (400B)


      1 # algo_004
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to count number of nodes in a singly linked list.
      6 
      7 ## Algorithm
      8 ```
      9 procedure count(head)
     10 begin
     11     count = 0;
     12     if(head = NULL)
     13         write(count);
     14     else 
     15         ptr ← head;
     16         while(ptr ≠ NULL)
     17             count ← count + 1;
     18             ptr ← next(ptr);
     19         end while
     20         write(count);
     21     endif
     22 end procedure
     23 ```
© 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