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