LoKwongho

mm

随笔分类 -  数据结构与算法练习

1 2 下一页

动态规划问题总结
摘要:最大子列和问题 >> 6 >> -2 11 -4 13 -5 -2 << 20 最大不下降子序列 LIS 用一个pre数组来进行回溯,如果结果不唯一,可以用一个vector<int> pre[maxn] 来记录,然后DFS >> 8 >> 1 2 3 -9 3 9 0 11 << 6 << 11 9 阅读全文

posted @ 2018-12-06 19:40 iojafekniewg 阅读(295) 评论(0) 推荐(0)

【转】Map 与 Unordered_map
摘要:map和unordered_map的差别和使用 map和unordered_map的差别和使用 map和unordered_map的差别还不知道或者搞不清unordered_map和map是什么的,请见:http://blog.csdn.net/billcyj/article/details/780 阅读全文

posted @ 2018-11-30 19:24 iojafekniewg 阅读(215) 评论(0) 推荐(0)

总结 搜索和最短路径问题
摘要:DFS BFS Dijkstra Spfa Floyd 阅读全文

posted @ 2018-11-28 13:25 iojafekniewg 阅读(523) 评论(0) 推荐(0)

1131 Subway Map DFS解法 BFS回溯!
摘要:In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing su 阅读全文

posted @ 2018-11-28 13:10 iojafekniewg 阅读(395) 评论(0) 推荐(0)

【转】B树、B+树、B*树
摘要:出处:http://blog.csdn.net/v_JULY_v 1.前言: 动态查找树主要有:二叉查找树(Binary Search Tree),平衡二叉查找树(Balanced Binary Search Tree),红黑树(Red-Black Tree ),B-tree/B+-tree/ B* 阅读全文

posted @ 2018-11-25 18:51 iojafekniewg 阅读(185) 评论(0) 推荐(0)

1119 Pre- and Post-order Traversals
摘要:Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino 阅读全文

posted @ 2018-11-25 16:05 iojafekniewg 阅读(226) 评论(0) 推荐(0)

1018 Public Bike Management
摘要:There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any s 阅读全文

posted @ 2018-11-25 14:57 iojafekniewg 阅读(229) 评论(0) 推荐(0)

1024 Palindromic Number int_string转换 大整数相加
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number 阅读全文

posted @ 2018-11-24 18:52 iojafekniewg 阅读(273) 评论(0) 推荐(0)

1057 Stack 树状数组
摘要:Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push ( 阅读全文

posted @ 2018-11-21 19:41 iojafekniewg 阅读(150) 评论(0) 推荐(0)

1045 Favorite Color Stripe 动态规划
摘要:1045 Favorite Color Stripe 1045. Favorite Color Stripe (30)Eva is trying to make her own color stripe out of a given one. She would like to keep only 阅读全文

posted @ 2018-11-21 10:45 iojafekniewg 阅读(285) 评论(0) 推荐(0)

1071 Speech Patterns
摘要:People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzi 阅读全文

posted @ 2018-11-16 08:50 iojafekniewg 阅读(294) 评论(0) 推荐(0)

1085. Perfect Sequence
摘要:Given a sequence of positive integers and another positive integer p. The sequence is said to be a “perfect sequence” if M <= m * p where M and m are 阅读全文

posted @ 2018-11-13 09:12 iojafekniewg 阅读(181) 评论(0) 推荐(0)

1093 Count PAT's
摘要:The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed 阅读全文

posted @ 2018-11-10 22:18 iojafekniewg 阅读(170) 评论(0) 推荐(0)

1098 Insertion or Heap Sort
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文

posted @ 2018-11-10 15:29 iojafekniewg 阅读(149) 评论(0) 推荐(0)

1101 Quick Sort
摘要:There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then th 阅读全文

posted @ 2018-11-09 14:41 iojafekniewg 阅读(185) 评论(0) 推荐(0)

1111 Online Map (30 分)
摘要:1111. Online Map (30)Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths t 阅读全文

posted @ 2018-11-08 21:14 iojafekniewg 阅读(384) 评论(0) 推荐(0)

1109 Group Photo
摘要:Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following: The number of people in each 阅读全文

posted @ 2018-11-08 11:00 iojafekniewg 阅读(331) 评论(0) 推荐(0)

1114 Family Property
摘要:This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under hi 阅读全文

posted @ 2018-11-07 20:11 iojafekniewg 阅读(341) 评论(0) 推荐(0)

N-Queens n皇后问题
摘要:八皇后问题:规则是皇后不能处于对角线,切皇后不能挨着递归回溯法 求八皇后问题解的个数 1 #include 2 #include 3 using namespace std; 4 const int maxn = 1003; 5 6 int n,sum = 0; 7 vector a; 8 9 bool isValid(int k,int i){ 10 bool ... 阅读全文

posted @ 2018-11-05 14:12 iojafekniewg 阅读(240) 评论(0) 推荐(0)

1129 Recommendation System
摘要:Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that 阅读全文

posted @ 2018-11-05 12:46 iojafekniewg 阅读(184) 评论(0) 推荐(0)

1 2 下一页

导航

My Email guangho2743##foxmail.com : )