## 《DATA STRUCTRUES A Psuedocode Approach with C++》Chaper 3. Linked List Learn Note

3-1 LINEAR LIST CONCEPTLinear lists can be divided into two categories: general and restricted.In a general list, data can be inserted and deleted anywhere and there are no restrictions on the operations that can be used to process the list. Such as the random list, ordered list.In a restricted list, data can only be added or deleted at the ends of the structure and processing is restricted to op... Read More

## 最大流问题之Ford-Fulkerson算法

Ford-Fulkerson算法（亦即标号法？）的输入与步骤如下输入给定一个容量为c的图G=(V, E)，源点s与汇点（终点）步骤对图G中每一个边(u, v)的流量f(u, v)进行初始化为查询过程：寻找（DFS、深度优先搜索方式）图G中的一条路径p，其中每一条边(u, v) ∈p，都有fc(u, v) = c(u, v) - f(u, v) > 0（c(u, v) 代表当前边的容量，f(u, v) 代表当前边已有的流量，即c(u, v) - f(u, v)代表当前边可用的最大流量，即剩余流量调整过程：计算当前路径下每条边的最小剩余容量，cf(p) = min{fc(u, v) : (u, v) ∈p}，然后对于每条边进行如下操作f(u, v) = f(u, v) + cf(p) （前向狐f(v, u) = f(v, u) - cf(p) （后向狐往复上述2与3步骤，直至无法找到路径p为止... Read More

## [LeetCode]Two Sum

ProbleDetermine whether an integer is a palindrome. Do this without extra space.Some hints[code lang="shell" collapse="true"Could negative integers be palindromes? (ie, -1If you are thinking of converting the integer to string, note the restriction of using extra space.You could also try reversing an integer. However, if you have solved the problem "Reverse Integer", you know that th... Read More

## [LeetCode]Roman to Integer

ProbleGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.IdeaFinding the Law of Changing Roman Numbers into Arabic Numbers。Solutio[code lang="cpp"class Solution publicint romanToInt(string s) int l = s.length(), a = 0;for (int i = 0; i < l; ++iif (i < l - 1 && char2int(s[i]) < char2int(s[i + 1])) a -= char2int(s[i]);} else a += char2int(s[i]);... Read More

## ZigZag Conversion(math)

QuestioThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibilityP A H A P L S I I Y I And then read line by line: "PAHNAPLSIIGYIR"Write the code that will take a string and make this conversion given a number of rowsstring convert(string text, int nRows);convert("PAYPAL... Read More

## 最长回文字符串题解（动态规划）

LeetCode正题Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.ExampleInput: "babad"Output: "bab"Note: "aba" is also a valid answer.ExampleInput: "cbbd"Output: "bb"思考回文字符串即正向顺序和反向顺序的字幕排序是一致的字段串。题的大意为寻找一个指定字符串中的最长的回文字符串。首选，暴力解法需要遍历所有子串并判断子串是否为回文字符串。假设给定字符串长度n，那么子串的总数为​n(n+1)/2（即1 2 3 ... n的和），即需要O（n^2），然后判断每个子串是否为回文字符串的时间复杂度为O（n），即总共需要... Read More