• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 2 3 4 5 6 7 8 9 10 ··· 27 下一页
2014年4月11日
Data Structure Linked List: Detect and Remove Loop in a Linked List
摘要: http://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct node {13 int data;14 node *next;15 node() : data(0), next(NULL) { }16 n... 阅读全文
posted @ 2014-04-11 05:05 ying_vincent 阅读(363) 评论(0) 推荐(0)
2014年4月10日
Data Structure Linked List: Reverse a Linked List in groups of given size
摘要: http://www.geeksforgeeks.org/reverse-a-list-in-groups-of-given-size/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct node {13 int data;14 node *next;15 node() : data(0), next(NULL) { }16 no... 阅读全文
posted @ 2014-04-10 14:49 ying_vincent 阅读(193) 评论(0) 推荐(0)
Data Structure Linked List: Merge Sort for Linked Lists
摘要: http://www.geeksforgeeks.org/merge-sort-for-linked-list/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct node {13 int data;14 node *next;15 node() : data(0), next(NULL) { }16 node(int d) : ... 阅读全文
posted @ 2014-04-10 12:48 ying_vincent 阅读(340) 评论(0) 推荐(0)
Data Structure Linked List: Write a function to get the intersection point of two Linked Lists.
摘要: http://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/第一第二个方法比较简单,下面这段代码是第三个方法 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct node {13 int data;14 node *n... 阅读全文
posted @ 2014-04-10 09:22 ying_vincent 阅读(204) 评论(0) 推荐(0)
Data Structure Linked List: Function to check if a singly linked list is palindrome
摘要: http://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/这里的reverse可以reverse整个list,这样空间需求就是O(n),不如这个网页写的O(1)的方法 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct node {13 int ... 阅读全文
posted @ 2014-04-10 08:08 ying_vincent 阅读(347) 评论(0) 推荐(0)
Data Structure Linked List: Write a function to reverse a linked list
摘要: iterative太简单不写了http://www.geeksforgeeks.org/write-a-function-to-reverse-the-nodes-of-a-linked-list/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct node {13 int data;14 node *next;15 node() : d... 阅读全文
posted @ 2014-04-10 07:35 ying_vincent 阅读(229) 评论(0) 推荐(0)
Data Structure Array: Move all zeroes to end of array
摘要: http://www.geeksforgeeks.org/move-zeroes-end-array/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 void movezero(int arr[], int n) {13 int c = 0;14 for (int i = 0; i < n; i++) {15 if (arr[i] == 0... 阅读全文
posted @ 2014-04-10 05:47 ying_vincent 阅读(144) 评论(0) 推荐(0)
Data Structure Array: Find if there is a subarray with 0 sum
摘要: http://www.geeksforgeeks.org/find-if-there-is-a-subarray-with-0-sum/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 bool zerosubarray(int arr[], int n) {13 set S;14 int sum = 0;15 for (int i = 0; i <... 阅读全文
posted @ 2014-04-10 05:42 ying_vincent 阅读(185) 评论(0) 推荐(0)
Data Structure Array: Find the Increasing subsequence of length three with maximum product
摘要: http://www.geeksforgeeks.org/increasing-subsequence-of-length-three-with-maximum-product/ 阅读全文
posted @ 2014-04-10 05:41 ying_vincent 阅读(171) 评论(0) 推荐(0)
Data Structure Array: Given an array of of size n and a number k, find all elements that appear more than n/k times
摘要: http://www.geeksforgeeks.org/given-an-array-of-of-size-n-finds-all-the-elements-that-appear-more-than-nk-times/这一题如果没空间要求就没那么麻烦了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 void more(int arr[], int n, int k) {12 map ... 阅读全文
posted @ 2014-04-10 04:21 ying_vincent 阅读(167) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 27 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3