bsc

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

root / semester_2 / algorithms / algo_004.md

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-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