We may earn an affiliate commission when you visit our partners.
Course image
Jiaying Liu 刘家瑛, Ph.D. and 郭 炜

算法代表着用系统的方法描述解决问题的策略机制,北京大学《算法基础》课程将带你一一探索枚举、二分、贪心、递归、深度优先搜索、广度优先搜索、动态规划等经典算法,体会他们巧妙的构思,感受他们利用计算解决问题的独特魅力。顺利完成本课程,你将不但能够掌握这些算法的原理,还能够对这些算法进行灵活应用以及准确实现。本课程的中的编程任务,将充分训练你的思维能力和动手能力,促成全面、缜密思考问题的习惯。达到本门课程的要求,即意味者你具备了初步的算法基础和较强的编程实现能力。

Enroll now

What's inside

Syllabus

欢迎加入我们!
好的算法是程序设计的灵魂!拥有了骄人战绩的你,在熟练掌握程序设计语言的同时,只有掌握了算法这个利器之后,才能在驾驭程序开发项目中出其不意、鬼斧神工!欢迎加入《算法基础》课程,为你的程序插上飞翔的翅膀!PS:我们这门课程一直处在不断地建设与优化当中,吸取了很多以往课程的经典视频,所以如果你看到视频中出现了不同课程的名字,也不要惊讶哦,因为你正在集百家所长:)
Read more
枚举
在日常生活中我们经常遇到这样的情景:数字密码最后一位忘记了,就从0~9逐个尝试;去提货点取快递,快递员检查完所有包裹才找到属于你的;警察列举出所有的嫌疑人才有可能发现真凶…以上在进行归纳推理时,逐个考察了某类事情的所有可能情况,并逐一进行检验,这种方法叫做枚举。枚举比较直观,易于理解,本模块将介绍枚举算法的基本数学模型和常用策略,从而解决通过公式推导、规则演绎的方法不能解决的问题。PS:我们这门课程一直处在不断地建设与优化当中,吸取了很多以往课程的经典视频,所以如果你看到视频中出现了不同课程的名字,也不要惊讶哦,因为你正在集百家所长:)
递归
递归调用是设计和描述算法的一种有力工具,尤其是在解决复杂问题时经常采用。它的基本思想是要解决某一问题A,可以先解决一个形式相同,但规模小一点的问题B。问题B如果解决了,那么问题A也就迎刃而解。有些问题使用传统的迭代算法是很难求解甚至无解的,而使用递归却可以很容易地解决。本模块将通过具体的例题介绍如何构造递归函数,如何设置递归终止的条件以及分析递归算法的复杂度。
动态规划(1)
通过上一模块的学习,你已经了解如何通过递归的办法解决问题,但是单纯的递归往往会导致子问题被重复计算,因此在解决某些问题的时候,效率会很低。而将一个问题分解为子问题递归求解,并且将中间结果保存以避免重复计算的方法就叫做“动态规划”。本模块将初步介绍对于特定的问题如何寻找子问题、定义问题的状态以及状态转移方程。
动态规划(2)
如何进行动态规划,没有一定之规,需要具体问题具体分析。本模块首先由典型的“最长上升子序列”引入,进一步展示几个较难的动规例题,深入探讨动态规划算法中状态的设计以及状态转移关系的构建。
深度优先搜索(1)
想象我们在一座迷宫里,如何才能找到出口呢?最直观的方法是从入口开始沿着一条路一直走到底,如果遇到分叉路口就选择其中一条道路走下去,如果遇到死胡同就退回到上一个分叉路口,选择另一条道路走下去,如果遇到出口就成功走出迷宫了。这种尽量往深处走的做法即是深度优先搜索(深搜)。深搜算法编程简单,简洁易懂,空间需求也比较低,但是这种方法的时间复杂度往往是指数级的,如果不加以优化,时间效率无法忍受。本模块将通过实例继续讨论深度优先搜索算法中优化程序的基本方法“剪枝”,即在设计剪枝判断方法的基础上,避免一些不必要的遍历过程,从而提高算法效率。
深度优先搜索(2)
本模块继续通过两道例题,强调了两种最通用的剪枝方法:可行性剪枝和最优性剪枝的应用。可行性剪枝即在寻找解的过程中,预判出从当前状态出发不可能找到解,从而不再从当前状态继续;最优性剪枝就是记录到目前为止找到的最优解,当发现正在探索的解其代价已经不小于最优解,或预测出其最终代价必将不小于最优解,则停止当前解的探索。
广度优先搜索
与深度优先搜索算法类似,广度优先搜索(广搜)也是常用的搜索图的算法。它的思想是从一个顶点开始,辐射状地优先遍历其周围较广的区域。一般可以用它做什么呢?一个最直观经典的例子就是走迷宫,从起点开始,找出到终点的最短路程,很多最短路径算法都是基于广搜的思想。广索的基本方法是使用队列存放已经扩展过的节点。本模块先以简单例题引入广搜的基本实现方法,然后再通过经典的"八数码"问题,进一步介绍状态表示、判重的节省时间和空间的技巧。
二分与贪心
二分法是在有序或单调的区间中快速寻找答案的有效方法,当数据量很大适宜采用该方法。所谓贪心算法,即总是作出在当前看来最好的选择。也就是说贪心算法并不从整体最优考虑,它所作出的选择只是在某种意义上的局部最优选择。但是,贪心算法对很多问题都能得到整体最优解。在一些情况下,即使贪心算法不能得到整体最优解,其最终结果却是最优解的很好近似。贪心算法没有固定的算法框架,算法设计的关键是贪心策略的选择。本模块将介绍二分与贪心这两个对很多问题都非常有效的算法策略。
期末考试
3个小时11道题目,这就是每年我们程序设计实习课程在校内的收官之作,让无数北大学生魂牵梦绕又各种怨念纠结的期末盛宴。你是不是准备好了呢?快来测测吧!也别忘了,搞定了基本算法并不代表着你作为程序员所向披靡啦,毕竟好的 程序=数据结构+算法。快去参加张铭老师的《数据结构基础》吧,你值得拥有!
结束语
真的要把课程的接力棒传给张老师了,颇有些不舍!很高兴通过MOOC专项课程的方式结识不一样的你。希望我们的课程能带给你收获与思考,加油,你会是一位出色的程序员!

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Guides students in visualizing solutions to problems by introducing concepts such as enumeration, binary search, recursion, and dynamic programming
Led by instructors who are well-known for their expertise in algorithm development and implementation
Teaches skills in implementing searching and algorithm techniques for software development
Builds a solid foundation in algorithm design and analysis techniques

Save this course

Save 算法基础 to your list so you can find it easily later:
Save

Reviews summary

Challenging but rewarding algorithms course

This course provides a solid foundation in algorithms, suitable for students with some programming experience. The material is challenging but well-explained, and the assignments help reinforce the concepts. However, some students may find the difficulty level high, and the lack of discussion forums can hinder learning.
Assignments reinforce concepts
Concepts explained clearly
Limited discussion options
"没有地方可以讨论,学习效率偏低。"
Challenging material
"对我来说真的太难了,老师教得很好,可是我就是没法领悟这些东西."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in 算法基础 with these activities:
Review notes and past assignments on recursion
Refresh your memory on recursion to prepare for more advanced topics.
Browse courses on Recursion
Show steps
  • Gather your notes, assignments, and any other materials on recursion from previous courses.
  • Go through the materials, focusing on key concepts and examples.
  • Identify any areas where you need additional clarification or practice.
  • Seek help from a classmate or instructor if needed.
Review the book 'Algorithm Design' by Jon Kleinberg and Éva Tardos
Expand your knowledge of algorithm design by delving into a comprehensive textbook.
View Algorithm Design on Amazon
Show steps
  • Read the book thoroughly, taking notes and highlighting key concepts.
  • Work through the exercises and problems at the end of each chapter.
  • Summarize the main ideas of each chapter and discuss them with classmates or a study group.
Participate in a discussion group on the trade-offs of different algorithms
Gain insights into the strengths and weaknesses of different algorithms by engaging in discussions with peers.
Show steps
  • Find a discussion group or forum where you can connect with other students.
  • Prepare by reviewing the course materials on algorithm comparison.
  • Actively participate in discussions, sharing your thoughts and asking questions.
  • Summarize key takeaways from the discussion and reflect on how they enhance your understanding of algorithms.
Two other activities
Expand to see all activities and additional details
Show all five activities
Complete practice drills on 二分查找(binary search)
Reinforce your understanding of 二分查找 by working through practice drills.
Browse courses on Binary Search
Show steps
  • Find practice drills on 二分查找 online or in textbooks.
  • Set a timer for 60 minutes and complete as many practice drills as possible.
  • Review your answers and identify any areas where you need additional practice.
Create a visual representation of the 贪心算法(greedy algorithm)
Deepen your understanding of 贪心算法 by creating a visual representation of its key concepts.
Show steps
  • Choose a specific greedy algorithm to focus on.
  • Identify the key steps and decision-making criteria involved in the algorithm.
  • Create a visual representation that clearly illustrates the flow of the algorithm and the decision-making process.
  • Consider using tools like flowcharts, diagrams, or infographics.

Career center

Learners who complete 算法基础 will develop knowledge and skills that may be useful to these careers:
Algorithm Engineer
Algorithm engineers develop algorithms and data structures to solve specific problems. They use their knowledge of mathematics, computer science, and algorithm design to create efficient and effective algorithms. This course on algorithm fundamentals provides a strong foundation for algorithm engineers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, algorithm engineers can develop more efficient and effective algorithms.
Machine Learning Engineer
Machine learning engineers design and develop machine learning models. They use their knowledge of algorithms, data structures, and machine learning techniques to create models that can learn from data and make predictions. This course on algorithm fundamentals provides a strong foundation for machine learning engineers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, machine learning engineers can develop more accurate and efficient machine learning models.
Data Scientist
Data scientists use their knowledge of mathematics, statistics, and computer science to extract insights from data. They develop algorithms and models to analyze data and make predictions. This course on algorithm fundamentals provides a strong foundation for data scientists by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, data scientists can develop more accurate and efficient models.
Software Engineer
Software engineers apply engineering principles to software design and development. They use their knowledge of programming languages, algorithms, and data structures to create efficient and reliable software systems. This course on algorithm fundamentals provides a strong foundation for software engineers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, software engineers can develop more efficient and effective software solutions.
Computer Scientist
Computer scientists conduct research and develop new computing technologies. They use their knowledge of mathematics, computer science, and algorithm design to create new algorithms, data structures, and software systems. This course on algorithm fundamentals provides a strong foundation for computer scientists by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, computer scientists can develop more efficient and effective computing technologies.
Quantitative Analyst
Quantitative analysts use mathematical and statistical models to analyze financial data and make investment decisions. They develop algorithms and models to analyze data and make predictions. This course on algorithm fundamentals provides a strong foundation for quantitative analysts by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, quantitative analysts can develop more accurate and efficient models.
Operations Research Analyst
Operations research analysts use mathematical and statistical models to solve business problems. They develop algorithms and models to optimize processes and make decisions. This course on algorithm fundamentals provides a strong foundation for operations research analysts by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, operations research analysts can develop more efficient and effective solutions to business problems.
Artificial Intelligence Engineer
Artificial Intelligence Engineers use their knowledge of mathematics, computer science, and algorithm design to design and develop AI systems. This course on algorithm fundamentals provides a strong foundation for AI Engineers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, AI Engineers can develop more efficient and effective systems.
Software Architect
Software architects design and develop the overall architecture of software systems. They use their knowledge of software engineering, algorithm design, and data structures to create scalable and reliable software systems. This course on algorithm fundamentals provides a strong foundation for software architects by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, software architects can develop more efficient and effective software systems.
Systems Engineer
Systems engineers design and build complex systems. They use their knowledge of systems engineering, algorithm design, and data structures to create efficient and reliable systems. This course on algorithm fundamentals provides a strong foundation for systems engineers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, systems engineers can develop more efficient and effective systems.
Data Engineer
Data engineers design and build data pipelines. They use their knowledge of data engineering, algorithm design, and data structures to create efficient and reliable data pipelines. This course on algorithm fundamentals provides a strong foundation for data engineers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, data engineers can develop more efficient and effective data pipelines.
Blockchain Developer
Blockchain developers design and develop blockchain systems. They use their knowledge of cryptography, computer science, and algorithm design to create secure and efficient blockchain systems. This course on algorithm fundamentals provides a strong foundation for blockchain developers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, blockchain developers can develop more efficient and effective blockchain systems.
Web Developer
Web developers design and develop websites. They use their knowledge of HTML, CSS, JavaScript, and algorithm design to create user-friendly and efficient websites. This course on algorithm fundamentals provides a strong foundation for web developers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, web developers can develop more efficient and effective websites.
Game Developer
Game developers design and develop video games. They use their knowledge of graphics, physics, and algorithm design to create fun and engaging games. This course on algorithm fundamentals provides a strong foundation for game developers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, game developers can develop more efficient and effective games.
Mobile Developer
Mobile developers design and develop mobile applications. They use their knowledge of native programming languages, mobile operating systems, and algorithm design to create user-friendly and efficient mobile applications. This course on algorithm fundamentals provides a strong foundation for mobile developers by teaching them the core concepts and techniques used in algorithm design and analysis. By understanding how algorithms work, mobile developers can develop more efficient and effective mobile applications.

Reading list

We've selected eight books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in 算法基础.
数据结构与算法分析是数据结构和算法领域的一本经典教材,本书注重算法的分析和证明,深入浅出地讲解了各种算法的复杂度和性能,是学习算法分析和提高算法能力的优秀参考书。
编程珠玑是编程领域的一本经典著作,本书收集了大量编程中的技巧和窍门,深入浅出地讲解了各种编程技术和算法的实现,是学习编程技巧和提高编程能力的优秀参考书。
代码大全是软件工程领域的一本经典著作,本书全面系统地介绍了软件开发中的各种最佳实践和反模式,是学习软件开发和提高编程能力的优秀参考书。
数学之美是一本数学科普著作,本书通过一个个生动有趣的故事,讲述了数学中的各种奥秘和应用,是培养数学思维和提高数学素养的优秀读物。
离散数学是一本离散数学领域的经典教材,本书全面系统地介绍了离散数学的基本概念和原理,是学习离散数学和提高数学素养的优秀参考书。
计算机网络是一本计算机网络领域的经典教材,本书全面系统地介绍了计算机网络的基本概念和原理,是学习计算机网络和提高计算机素养的优秀参考书。
软件工程是一本软件工程领域的经典教材,本书全面系统地介绍了软件工程的基本概念和原理,是学习软件工程和提高计算机素养的优秀参考书。
人工智能是一本人工智能领域的经典教材,本书全面系统地介绍了人工智能的基本概念和原理,是学习人工智能和提高计算机素养的优秀参考书。

Share

Help others find this course page by sharing it with your friends and followers:
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser