上一页 1 2 3 4 5 6 7 ··· 19 下一页

2016年5月8日

滑动窗口的最大值

摘要: 1 class Solution { 2 public: 3 vector maxInWindows(const vector& num, unsigned int size) 4 { 5 vector res; 6 if(num.empty() || size= num[index.back()]) 18 ... 阅读全文

posted @ 2016-05-08 15:57 RenewDo 阅读(116) 评论(0) 推荐(0) 编辑

数据流中的中位数

摘要: 1 class Solution { 2 public: 3 void Insert(int num) 4 { 5 if((count&1) == 0) 6 { 7 if(max.size()>0 &&num ()); 11 num = max.front(); 12 ... 阅读全文

posted @ 2016-05-08 14:43 RenewDo 阅读(113) 评论(0) 推荐(0) 编辑

二叉搜索树的第K个节点

摘要: 1 /* 2 struct TreeNode { 3 int val; 4 struct TreeNode *left; 5 struct TreeNode *right; 6 TreeNode(int x) : 7 val(x), left(NULL), right(NULL) { 8 } 9 }; 10 *... 阅读全文

posted @ 2016-05-08 13:37 RenewDo 阅读(203) 评论(0) 推荐(0) 编辑

2016年5月7日

序列化二叉树

摘要: 这题挺有意思的,开始有好几个问题都没有意识到,自己调试时没调到结果,只是在本地看了一下中间结果,发现对了,后来提交总是出问题。(实际这题牛客网没有检查中间序列化的结果,只看最终反序列化后的树) 发现了自己的几处问题: 1、一开始没有用cur计数,只用了str,它是char*类型,导致在子函数变化过程 阅读全文

posted @ 2016-05-07 23:11 RenewDo 阅读(654) 评论(0) 推荐(0) 编辑

2016年5月5日

把二叉树打印成多行

摘要: 1 class Solution { 2 public: 3 vector > Print(TreeNode* pRoot) { 4 vector> res; 5 if(pRoot == NULL) 6 return res; 7 queue node; 8 node.pu... 阅读全文

posted @ 2016-05-05 21:35 RenewDo 阅读(136) 评论(0) 推荐(0) 编辑

按之字形打印数据

摘要: 1 class Solution { 2 public: 3 vector > Print(TreeNode* pRoot) { 4 vector> res; 5 if(pRoot == NULL) 6 return res; 7 stack num[2]; 8 int flag[... 阅读全文

posted @ 2016-05-05 21:18 RenewDo 阅读(167) 评论(0) 推荐(0) 编辑

对称的二叉树

摘要: 1 class Solution { 2 public: 3 bool isSame(TreeNode* p1, TreeNode* p2) 4 { 5 if(!p1 && !p2) 6 return true; 7 if(!p1 || !p2) 8 return false; ... 阅读全文

posted @ 2016-05-05 20:42 RenewDo 阅读(94) 评论(0) 推荐(0) 编辑

二叉树的下一个结点

摘要: 1 class Solution { 2 public: 3 TreeLinkNode* GetNext(TreeLinkNode* pNode) 4 { 5 if(pNode == NULL ) 6 return NULL; 7 TreeLinkNode *p= NULL; 8 if(pNo... 阅读全文

posted @ 2016-05-05 20:32 RenewDo 阅读(139) 评论(0) 推荐(0) 编辑

2016年5月3日

Linux错误提示

摘要: 当程序缺乏某个头文件时,程序依然可以运行,但会在编译阶段弹出警告信息: 警告信息如下: warning: implicit declaration of function ‘htol’ [-Wimplicit-function-declaration] 编译器默认该函数会在其他的模块中定义,在链接阶 阅读全文

posted @ 2016-05-03 23:54 RenewDo 阅读(166) 评论(0) 推荐(0) 编辑

删除链表中重复的结点

摘要: 1 class Solution { 2 public: 3 ListNode* deleteDuplication(ListNode* pHead) 4 { 5 if(pHead == NULL || pHead->next == NULL) 6 return pHead; 7 ListNode *head = NULL,... 阅读全文

posted @ 2016-05-03 11:57 RenewDo 阅读(106) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 19 下一页

导航