1 Introduction
【Udemy高分付费课程】Python数据结构与算法 - 终极 Python 编码面试和计算机科学训练营(中英文字幕)_哔哩哔哩_bilibili断断续续一周刷完了udemy的数据结构和算法课程,由于之前只学过Python和Matlab,所以选择用python来学习数据结构;视频通过动画演示,使晦涩难懂的知识变得清晰有趣了很多,以此作为入门是极好的(尤其是英语不错的同学),推荐一波。
2 Big O
Big O is the compare effect for both the time complexity and space complexity. It describes the worst case when running a program, which leads to the biggest complexity.
omega (n): best case, theta(n): medium case, O(n): worst case
2.1 O(n)
Some examples:
O(n) : proportional
O(n*2): loop within a loop
O(log n): divide and conquer
O(1): constant
O(n log n): a combined case o