time : O(n) space : O(1)
| 52 | // time : O(n) |
| 53 | // space : O(1) |
| 54 | int countNodes(struct Node *p) |
| 55 | { |
| 56 | // while address of next block is not null |
| 57 | int count = 0; |
| 58 | |
| 59 | while (p != NULL) |
| 60 | { |
| 61 | count++; |
| 62 | p = p->next; |
| 63 | } |
| 64 | |
| 65 | return count; |
| 66 | } |
| 67 | |
| 68 | void insert(struct Node *p, int index, int data) |
| 69 | { |
nothing calls this directly
no outgoing calls
no test coverage detected