1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | struct node{ int val; node* next = nullptr; }; bool push(node* _node, int _val){ _node->next = new node(); _node->next->val =_val; _node->next->next = nullptr; return true; } int pop_back(node* _list){ if(_list->next != nullptr) pop_back(_list->next); else{ return _list->val; } } void co_nodes(node* _node){ cout << _node->val << endl; if(_node->next != nullptr) co_nodes(_node->next); } int main(int argc, char *argv[]) { node* list = new node(); list->val = 0; push(list, 1); co_nodes(list); cout << "end main " << endl; } | cs |
'Data Structure And Algorithm' 카테고리의 다른 글
Counting Sort 예제 (0) | 2019.03.31 |
---|---|
퀵 소트 구현 (0) | 2019.03.31 |