摘要:最大子列和问题 >> 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
阅读全文
摘要:map和unordered_map的差别和使用 map和unordered_map的差别和使用 map和unordered_map的差别还不知道或者搞不清unordered_map和map是什么的,请见:http://blog.csdn.net/billcyj/article/details/780
阅读全文
摘要:DFS
BFS
Dijkstra
Spfa
Floyd
阅读全文
摘要: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
阅读全文
摘要:出处:http://blog.csdn.net/v_JULY_v 1.前言: 动态查找树主要有:二叉查找树(Binary Search Tree),平衡二叉查找树(Balanced Binary Search Tree),红黑树(Red-Black Tree ),B-tree/B+-tree/ B*
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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 (
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:八皇后问题:规则是皇后不能处于对角线,切皇后不能挨着递归回溯法 求八皇后问题解的个数 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 ...
阅读全文
摘要: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
阅读全文