-
Print the Elements of a Linked List해커랭크(HackerRank) 2018. 8. 19. 17:23반응형
1. 문제
2. 알고리즘
키워드 - 구현, 출력
3. 코드
123456789101112131415161718192021/*Print elements of a linked list on consolehead pointer input could be NULL as well for empty listNode is defined asstruct Node{int data;struct Node *next;}*/void Print(Node *head){if(!head)return ;// This is a "method-only" submission.// You only need to complete this method.if(head->data)cout << head->data << endl;Print(head->next);}cs 반응형'해커랭크(HackerRank)' 카테고리의 다른 글
Arrays - DS (0) 2018.08.19 Sparse Arrays (0) 2018.08.19 Insert a Node at the Tail of a Linked List (0) 2018.08.19 Maximum Element (0) 2018.08.19 Print in Reverse (0) 2018.08.19