实现链表打印

This commit is contained in:
2023-05-19 13:46:00 +08:00
parent 29ddbd5a3e
commit ff08160831
12 changed files with 172 additions and 108 deletions
+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include <iostream>
#include <string>
#include <stack>
namespace yaha {
class CQueue {
public:
CQueue() {
}
void append_tail(int value);
int delete_head();
private:
std::stack<int> _stk_tail;
std::stack<int> _stk_head;
};
class String {
public:
std::string replace_space(std::string s);
};
class ListNode {
public:
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
std::vector<int> reverse_print(ListNode *head);
void reverse(ListNode *head, std::vector<int>& res);
};
}
-16
View File
@@ -1,16 +0,0 @@
#pragma once
#include <stack>
namespace yaha {
class CQueue {
public:
CQueue() {
}
void append_tail(int value);
int delete_head();
private:
std::stack<int> _stk_tail;
std::stack<int> _stk_head;
};
}