你好,我是王争。今天是节后的第一个工作日,也是我们“春节七天练”的最后一篇。


几种算法思想必知必会的代码实现

回溯

  • 利用回溯算法求解八皇后问题
  • 利用回溯算法求解0-1背包问题

分治

  • 利用分治算法求一组数据的逆序对个数

    动态规划

  • 0-1背包问题

  • 最小路径和(详细可看@Smallfly整理的 Minimum Path Sum)
  • 编程实现莱文斯坦最短编辑距离
  • 编程实现查找两个字符串的最长公共子序列
  • 编程实现一个数据序列的最长递增子序列

对应的LeetCode练习题(@Smallfly 整理)

  • Regular Expression Matching(正则表达式匹配)

英文版:https://leetcode.com/problems/regular-expression-matching/
中文版:https://leetcode-cn.com/problems/regular-expression-matching/

  • Minimum Path Sum(最小路径和)

英文版:https://leetcode.com/problems/minimum-path-sum/
中文版:https://leetcode-cn.com/problems/minimum-path-sum/

  • Coin Change (零钱兑换)

英文版:https://leetcode.com/problems/coin-change/
中文版:https://leetcode-cn.com/problems/coin-change/

  • Best Time to Buy and Sell Stock(买卖股票的最佳时机)

英文版:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
中文版:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/

  • Maximum Product Subarray(乘积最大子序列)

英文版:https://leetcode.com/problems/maximum-product-subarray/
中文版:https://leetcode-cn.com/problems/maximum-product-subarray/

  • Triangle(三角形最小路径和)

英文版:https://leetcode.com/problems/triangle/
中文版:https://leetcode-cn.com/problems/triangle/


到此为止,七天的练习就结束了。这些题目都是我精选出来的,是基础数据结构和算法中最核心的内容。建议你一定要全部手写练习。如果一遍搞不定,你可以结合前面的章节,多看几遍,反复练习,直到能够全部搞定为止。
学习数据结构和算法,最好的方法就是练习和实践。我相信这在任何知识的学习过程中都适用。
最后,祝你工作顺利!学业进步!