摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 struct Node 4 { 5 int value; 6 Node * next; 7 }; 8 9 Node * reverse(Node * head)10 {11 Node * ret = NULL;12 while (head != NULL)13 {14 Node * temp = head->next;15 head->next = ret;1... 阅读全文
posted @ 2013-05-08 16:56 weiwei5987 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 压缩字符串,input:aaabbbccc output:3a3b3c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 char* compress(const char * src, char *des) 5 { 6 if (des==NULL) 7 { 8 return NULL; 9 }10 int count = 1;11 int pointer = 0;12 char cu... 阅读全文
posted @ 2013-05-08 16:54 weiwei5987 阅读(245) 评论(0) 推荐(1) 编辑
摘要: 1 View Code 2 #include <iostream> 3 #include <vector> 4 using namespace std; 5 6 7 struct BinaryTreeNode 8 { 9 int m_nValue;10 BinaryTreeNode * m_pLeft;11 BinaryTreeNode * m_pRight;12 };13 14 15 void print(vector<int> & v)16 {17 for (vector<int>::i... 阅读全文
posted @ 2013-05-08 16:52 weiwei5987 阅读(179) 评论(0) 推荐(0) 编辑