Skip to content

Commit

Permalink
Update Linkedlist.c
Browse files Browse the repository at this point in the history
  • Loading branch information
akhil-maker authored Oct 2, 2021
1 parent 3ad6a7a commit a9a5a41
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions C/Linkedlist.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//Problem: Create a singly linked list and traverse in it.
#include<stdio.h>
#include<stdlib.h>

//Create node of linked list
struct Node {
int data;
struct Node* next;
};

//linked list traversal
//Complexity: O(n) where n = number of nodes
void LLTraversal(struct Node* ptr){
while(ptr!=NULL){
printf("%d\n", ptr->data);
Expand Down Expand Up @@ -37,4 +40,4 @@ int main()

LLTraversal(head);
return 0;
}
}

0 comments on commit a9a5a41

Please sign in to comment.