diff --git a/data_structures/linked_list/stack_using_linked_lists.c b/data_structures/linked_list/stack_using_linked_lists.c index 4bbd7c2d9f..0e10554af3 100644 --- a/data_structures/linked_list/stack_using_linked_lists.c +++ b/data_structures/linked_list/stack_using_linked_lists.c @@ -36,7 +36,12 @@ int main() } } -void push(struct node *p) +/** + * push function will add a new node at the head of the list, time complexity O(1) + * @param p pointer to the top of the stack + * @returns void + */ +void push(struct node *p) { int item; struct node *temp; @@ -50,7 +55,13 @@ void push(struct node *p) printf("inserted succesfully\n"); } -void pop(struct node *p) + +/** + * pop function deletes the first node from the head, time complexity O(1) + * @param p pointer to the top of the stack + * @returns void + */ +void pop(struct node *p) { int item; struct node *temp; @@ -79,6 +90,5 @@ void display(struct node *p) printf("%d\n", p->info); p = p->link; } - // printf("%d\n",p->info); } }