skip to main |
skip to sidebar
Node Count in Single Linked List
Algorithm for Node Count
- Step 1: First check the head status, if head status is NULL then return 0(Zero) i.e.Empty Linked list.
- If head status is other then NULL then do...
- Take a counter and assign value to 0(Zero).
- Take a temporary head and assign current head value to th.
- Design a loop to travel until tail is occur.
- For every repetition increment counter value by 1 and shift th to next link.
- Return counter value when loop is terminated.
0 comments:
Post a Comment