链表反转
This commit is contained in:
+36
-5
@@ -7,9 +7,6 @@
|
||||
namespace yaha {
|
||||
class CQueue {
|
||||
public:
|
||||
CQueue() {
|
||||
}
|
||||
|
||||
void append_tail(int value);
|
||||
int delete_head();
|
||||
|
||||
@@ -20,7 +17,22 @@ private:
|
||||
|
||||
class String {
|
||||
public:
|
||||
/**
|
||||
* 剑指 Offer 09. 用两个栈实现队列
|
||||
*
|
||||
* @url https://leetcode.cn/leetbook/read/illustration-of-algorithm/5d3i87/
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
std::string replace_space(std::string s);
|
||||
|
||||
/**
|
||||
* 剑指 Offer 20. 表示数值的字符串
|
||||
*
|
||||
* @url https://leetcode.cn/leetbook/read/illustration-of-algorithm/5d6vi6/
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
bool is_number(std::string s);
|
||||
};
|
||||
|
||||
@@ -29,9 +41,28 @@ public:
|
||||
int val;
|
||||
ListNode *next;
|
||||
ListNode(int x) : val(x), next(NULL) {}
|
||||
|
||||
/**
|
||||
* 剑指 Offer 06. 从尾到头打印链表
|
||||
*
|
||||
* @url https://leetcode.cn/leetbook/read/illustration-of-algorithm/5dt66m/
|
||||
* @param head
|
||||
* @return
|
||||
*/
|
||||
std::vector<int> reverse_print(ListNode *head);
|
||||
void reverse_stack(ListNode *head, std::vector<int>& res);
|
||||
void reverse(ListNode *head, std::vector<int>& res);
|
||||
|
||||
void reverse_stack(ListNode *head, std::vector<int> &res);
|
||||
void reverse(ListNode *head, std::vector<int> &res);
|
||||
|
||||
/**
|
||||
* 剑指 Offer 24. 反转链表
|
||||
*
|
||||
* @url https://leetcode.cn/leetbook/read/illustration-of-algorithm/9pdjbm/
|
||||
* @param head
|
||||
* @return
|
||||
*/
|
||||
ListNode *reverse_list(ListNode *head);
|
||||
ListNode* reverse_list(ListNode* cur, ListNode* pre);
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user