0329 first commit

This commit is contained in:
flyotlin 2020-03-29 21:33:03 +08:00
parent 175856a3eb
commit 219cf60866
1 changed files with 705 additions and 0 deletions

705
translations/README-tw.md Normal file
View File

@ -0,0 +1,705 @@
# Coding Interview University
> 原先我為了成為一個軟體工程師而建立這份簡單的讀書主題清單(To-do list)
> 但這份To-do list隨著時間而膨脹成這個樣子。 [做完這份To-do list上的每個目標後我成為了Amazon的工程師](https://startupnextdoor.com/ive-been-acquired-by-amazon/?src=ciu)!
> 你或許不需要像我讀一樣多。但是,每個讓你成為一位稱職工程師所需要的知識都在這裡了。
>
> 我每天讀8~12小時的書這樣持續了好幾個月。這是我的故事:[為什麼我為了Google面試而讀了8個月](https://medium.freecodecamp.org/why-i-studied-full-time-for-8-months-for-a-google-interview-cc662ce9bb13)
>
> 在這份To-do list內的主題會讓你擁有足夠的知識去面對幾乎每家軟體公司的專業面試
> 這些公司包含了科技巨獸例如Amazon、Facebook、Google或者是Microsoft。
>
> *祝你好運!*
<details>
<summary>翻譯:</summary>
- [中文版本](translations/README-cn.md)
- [Tiếng Việt - Vietnamese](translations/README-vi.md)
- [Español](translations/README-es.md)
- [Português Brasileiro](translations/README-ptbr.md)
</details>
<details>
<summary>正在翻譯的項目:</summary>
- [हिन्दी](https://github.com/jwasham/coding-interview-university/issues/81)
- [עברית](https://github.com/jwasham/coding-interview-university/issues/82)
- [Bahasa Indonesia](https://github.com/jwasham/coding-interview-university/issues/101)
- [Arabic](https://github.com/jwasham/coding-interview-university/issues/98)
- [Turkish](https://github.com/jwasham/coding-interview-university/issues/90)
- [French](https://github.com/jwasham/coding-interview-university/issues/89)
- [Russian](https://github.com/jwasham/coding-interview-university/issues/87)
- [Ukrainian](https://github.com/jwasham/coding-interview-university/issues/106)
- [Korean(한국어)](https://github.com/jwasham/coding-interview-university/issues/118)
- [Telugu](https://github.com/jwasham/coding-interview-university/issues/117)
- [Polish](https://github.com/jwasham/coding-interview-university/issues/122)
- [Urdu](https://github.com/jwasham/coding-interview-university/issues/140)
- [Thai](https://github.com/jwasham/coding-interview-university/issues/156)
- [Greek](https://github.com/jwasham/coding-interview-university/issues/166)
- [Italian](https://github.com/jwasham/coding-interview-university/issues/170)
- [Malayalam](https://github.com/jwasham/coding-interview-university/issues/239)
- [Japanese (日本語)](https://github.com/jwasham/coding-interview-university/issues/257)
</details>
## What is it?
這是我為了從一個網頁開發者(自學,並且沒有任何與資工、電腦科學有關的學位),成為一個大公司軟體工程師,持續好幾個月的讀書計畫。
![Coding at the whiteboard - from HBO's Silicon Valley](https://d3j2pkmjtin6ou.cloudfront.net/coding-at-the-whiteboard-silicon-valley.png)
這是為了那些**新手軟體工程師**,或者是那些想要轉換跑道,從軟體/網頁開發者轉為軟體工程師(需要資工、電腦科學的知識)的人。
請注意就算你有多年的軟體/網頁開發經驗那些著名的大型軟體公司像是Google、Amazon、Facebook或是Microsoft事實上把軟體/網頁開發(Software/Web Development)與軟體工程(Software Engineering)視為不同,而後者需要的是電腦科學/資訊工程的知識。
如果你想成為一個可靠的工程師或者是Operation Engineer閱讀並且學習更多這份清單中的The Optional List(裡面包含網路與資訊安全的知識)。
---
## 目錄
- [What is it?](#what-is-it)
- [Why use it?](#why-use-it)
- [How to use it](#how-to-use-it)
- [不要覺得自己不夠聰明](#dont-feel-you-arent-smart-enough(不要覺得自己不夠聰明))
- [關於影片資源](#about-video-resources(關於影片資源))
- [面試過程&面試準備](#interview-process--general-interview-prep(面試過程&面試準備))
- [面試時專精一種程式語言](#面試時專精一種程式語言(Pick-One-Language-for-the-Interview))
- [書單](#書單(book-list))
- [在你開始之前](#在你開始之前)
- [這份清單沒有包含的內容](#這份清單沒有包含的內容)
- [先備知識](#先備知識)
- [每日計畫](#每日計畫)
- [演算法複雜度(Algorithmic complexity) / Big-O / 漸進分析(Asymptotic analysis)](#演算法複雜度(Algorithmic-complexity)--Big-O--漸進分析(Asymptotic-analysis))
- [資料結構](#資料結構)
- [Arrays](#arrays)
- [Linked Lists](#linked-lists)
- [Stack](#stack)
- [Queue](#queue)
- [Hash table](#hash-table)
- [More Knowledge](#more-knowledge)
- [Binary search](#binary-search)
- [Bitwise operations](#bitwise-operations)
- [Trees](#trees)
- [Trees - Notes & Background](#trees---notes--background)
- [Binary search trees: BSTs](#binary-search-trees-bsts)
- [Heap / Priority Queue / Binary Heap](#heap--priority-queue--binary-heap)
- balanced search trees (general concept, not details)
- traversals: preorder, inorder, postorder, BFS, DFS
- [排序](#排序)
- selection
- insertion
- heapsort
- quicksort
- merge sort
- [Graphs](#graphs)
- directed
- undirected
- adjacency matrix
- adjacency list
- traversals: BFS, DFS
- [Even More Knowledge](#even-more-knowledge)
- [Recursion](#recursion)
- [Dynamic Programming](#dynamic-programming)
- [Object-Oriented Programming](#object-oriented-programming)
- [Design Patterns](#design-patterns)
- [Combinatorics (n choose k) & Probability](#combinatorics-n-choose-k--probability)
- [NP, NP-Complete and Approximation Algorithms](#np-np-complete-and-approximation-algorithms)
- [Caches](#caches)
- [Processes and Threads](#processes-and-threads)
- [Testing](#testing)
- [Scheduling](#scheduling)
- [String searching & manipulations](#string-searching--manipulations)
- [Tries](#tries)
- [Floating Point Numbers](#floating-point-numbers)
- [Unicode](#unicode)
- [Endianness](#endianness)
- [Networking](#networking)
- [System Design, Scalability, Data Handling](#system-design-scalability-data-handling) (if you have 4+ years experience)
- [Final Review](#final-review)
- [Coding Question Practice](#coding-question-practice)
- [Coding exercises/challenges](#coding-exerciseschallenges)
- [Once you're closer to the interview](#once-youre-closer-to-the-interview)
- [Your Resume](#your-resume)
- [Be thinking of for when the interview comes](#be-thinking-of-for-when-the-interview-comes)
- [Have questions for the interviewer](#have-questions-for-the-interviewer)
- [Once You've Got The Job](#once-youve-got-the-job)
---------------- Everything below this point is optional ----------------
## Additional Resources
- [Additional Books](#additional-books)
- [Additional Learning](#additional-learning)
- [Compilers](#compilers)
- [Emacs and vi(m)](#emacs-and-vim)
- [Unix command line tools](#unix-command-line-tools)
- [Information theory](#information-theory-videos)
- [Parity & Hamming Code](#parity--hamming-code-videos)
- [Entropy](#entropy)
- [Cryptography](#cryptography)
- [Compression](#compression)
- [Computer Security](#computer-security)
- [Garbage collection](#garbage-collection)
- [Parallel Programming](#parallel-programming)
- [Messaging, Serialization, and Queueing Systems](#messaging-serialization-and-queueing-systems)
- [A*](#a)
- [Fast Fourier Transform](#fast-fourier-transform)
- [Bloom Filter](#bloom-filter)
- [HyperLogLog](#hyperloglog)
- [Locality-Sensitive Hashing](#locality-sensitive-hashing)
- [van Emde Boas Trees](#van-emde-boas-trees)
- [Augmented Data Structures](#augmented-data-structures)
- [Balanced search trees](#balanced-search-trees)
- AVL trees
- Splay trees
- Red/black trees
- 2-3 search trees
- 2-3-4 Trees (aka 2-4 trees)
- N-ary (K-ary, M-ary) trees
- B-Trees
- [k-D Trees](#k-d-trees)
- [Skip lists](#skip-lists)
- [Network Flows](#network-flows)
- [Disjoint Sets & Union Find](#disjoint-sets--union-find)
- [Math for Fast Processing](#math-for-fast-processing)
- [Treap](#treap)
- [Linear Programming](#linear-programming-videos)
- [Geometry, Convex hull](#geometry-convex-hull-videos)
- [Discrete math](#discrete-math)
- [Machine Learning](#machine-learning)
- [Additional Detail on Some Subjects](#additional-detail-on-some-subjects)
- [Video Series](#video-series)
- [Computer Science Courses](#computer-science-courses)
- [Papers](#papers)
---
## Why use it?
當我開始這項計畫的時候我不知道Stack與Heap的差別不知道時間複雜度(Big-O),不知道樹狀結構(Tree),也不知道如何遍歷一個圖(Graph)。過去如果我需要寫一個排序演算法(Sorting Algorithm)那個code一定是個災難。我過去都用程式語言中內建的資料結構(Data Structure),對於資料結構裡面的實作方法跟原理我完全沒有任何的概念。除非我的程式碰到了"out of memory"的錯誤我才會去找解決方法,否則我從不特別去花費心思管理程式中的記憶體配置。雖然我有用過多維陣列(Multidimensional Arrays)跟關聯陣列(Associative Arrays),但我從來沒有自己時做過資料結構。
這是個遠大的計畫,或許要花上你數個月的時間。如果你對其中大部分的東西已經很熟悉的話,那麼執行這項計畫所花費的時間將減少許多。
## How to use it
下面每項是大綱,你需要從上到下的去理解這些大綱。
我用了Github-flavored markdown語法其中包含了可以確定完成進度的任務清單。
**建立一個新的Branch以使用Github-flavored markdown的勾選功能。只要在[]中打x像是: [x]**
Fork一個branch並且跟隨以下的指令
`git checkout -b progress`
`git remote add jwasham https://github.com/jwasham/coding-interview-university`
`git fetch --all`
在你完成了一些目標後在框框中打x
`git add .`
`git commit -m "Marked x"`
`git rebase jwasham/master`
`git push --force`
[更多有關Github-flavored markdown](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown)
## Don't feel you aren't smart enough(不要覺得自己不夠聰明)
- 大多數成功的軟體工程師都非常聰明,但他們都有一種覺得自己不夠聰明的不安全感。
- [The myth of the Genius Programmer(天才Programmer的迷思)](https://www.youtube.com/watch?v=0SARbwvhupQ)
- [It's Dangerous to Go Alone: Battling the Invisible Monsters in Tech(不要單打獨鬥:面對科技中的隱形怪物)](https://www.youtube.com/watch?v=1i8ylq4j_EY)
## About Video Resources(關於影片資源)
有些影片要註冊Coursera或者Edx的課程後才能觀看也就是所謂的MOOCs。有時候某些課程需要等待好幾個月才能註冊這期間你無法觀看這些課程的影片。
我非常喜歡那些大學的線上課程。感謝你們幫忙加入一些免費、可隨時觀看的公開資源像是那些線上課程的YouTube影片。
## Interview Process & General Interview Prep(面試過程&面試準備)
- [ ] [ABC: Always Be Coding](https://medium.com/always-be-coding/abc-always-be-coding-d5f8051afce2#.4heg8zvm4)
- [ ] [Whiteboarding](https://medium.com/@dpup/whiteboarding-4df873dbba2e#.hf6jn45g1)
- [ ] [Effective Whiteboarding during Programming Interviews](http://www.coderust.com/blog/2014/04/10/effective-whiteboarding-during-programming-interviews/)
- [ ] [Demystifying Tech Recruiting](https://www.youtube.com/watch?v=N233T0epWTs)
- [ ] 如何錄取Big Tech(Google, Amazon, Facebook, Apple):
- [ ] [How to Get a Job at the Big 4 - Amazon, Facebook, Google & Microsoft (video)](https://www.youtube.com/watch?v=YJZCUhxNCv8)
- [ ] Coding面試解密:
- [ ] [Gayle L McDowell - Cracking The Coding Interview (video)](https://www.youtube.com/watch?v=rEJzOhC5ZtQ)
- [ ] [Cracking the Coding Interview with Author Gayle Laakmann McDowell (video)](https://www.youtube.com/watch?v=aClxtDcdpsQ)
- [ ] Facebook Coding面試解密:
- [ ] [The Approach](https://www.youtube.com/watch?v=wCl9kvQGHPI)
- [ ] [Problem Walkthrough](https://www.youtube.com/watch?v=4UWDyJq8jZg)
- [ ] 準備課程:
- [ ] [Software Engineer Interview Unleashed (paid course)](https://www.udemy.com/software-engineer-interview-unleashed):
- 從前Google面試官身上學習如何充實自己讓自己能夠應付軟體工程師的面試。
- [ ] [Python for Data Structures, Algorithms, and Interviews (paid course)](https://www.udemy.com/python-for-data-structures-algorithms-and-interviews/):
- Python面試準備課程其中包含了資料結構、演算法、模擬面試等等。
- [ ] [Intro to Data Structures and Algorithms using Python (Udacity free course)](https://www.udacity.com/course/data-structures-and-algorithms-in-python--ud513):
- Python免費資料結構及演算法課程。
- [ ] [Data Structures and Algorithms Nanodegree! (Udacity paid Nanodegree)](https://www.udacity.com/course/data-structures-and-algorithms-nanodegree--nd256):
- 超過100種實際的資料結構及演算法練習。名師指導讓你準備好面試以及工作的實際情況。
## 面試時專精一種程式語言(Pick One Language for the Interview)
在面試的coding階段你可以選擇任何一個你擅長的程式語言。但多數大公司僅有以下選擇:
- C++
- Java
- Python
你也可以選擇以下的程式語言,但可能會有某些限制:
- JavaScript
- Ruby
我之前寫過一篇關於在面試時選擇程式語言的文章:[Pick One Language for the Coding Interview](https://startupnextdoor.com/important-pick-one-language-for-the-coding-interview/)
你需要非常熟練這個程式語言,並且對他非常了解。
閱讀更多有關程式語言的選擇:
- http://www.byte-by-byte.com/choose-the-right-language-for-your-coding-interview/
- http://blog.codingforinterviews.com/best-programming-language-jobs/
[程式語言相關資源](programming-language-resources.md)
因為我正在學習C、C++以及Python所以下面會出現一些有關於這些程式語言的資源。
## 書單(Book List)
為了節省你的時間,以下是已經縮減過的書單。
### 面試準備(Interview Prep)
- [ ] [Programming Interviews Exposed: Coding Your Way Through the Interview, 4th Edition](https://www.amazon.com/Programming-Interviews-Exposed-Through-Interview/dp/111941847X/)
- 附有解答 in C++ and Java
- 內含很棒的coding面試解密
- 不會很困難,大多問題都比面試中的還簡單(從我讀過的)
- [ ] [Cracking the Coding Interview, 6th Edition](http://www.amazon.com/Cracking-Coding-Interview-6th-Programming/dp/0984782850/)
- 附有解答 in Java
### 如果你有額外的時間(If you have tons of extra time):
選擇以下其中一個:
- [ ] [Elements of Programming Interviews (C++ version)](https://www.amazon.com/Elements-Programming-Interviews-Insiders-Guide/dp/1479274836)
- [ ] [Elements of Programming Interviews in Python](https://www.amazon.com/Elements-Programming-Interviews-Python-Insiders/dp/1537713949/)
- [ ] 程式面試精華 (Java版)
- [book](https://www.amazon.com/Elements-Programming-Interviews-Java-Insiders/dp/1517435803/)
- [Companion Project - Method Stub and Test Cases for Every Problem in the Book](https://github.com/gardncl/elements-of-programming-interviews)
### 程式語言精進
***面試時你需要選擇一種程式語言(詳如上述)***
以下是一些我對程式語言的建議。這邊沒有所有種類程式語言的資源,所以歡迎補充。
如果你讀過以下其中一本你應該已經具備了所有解決coding問題所需要的資料結構與演算法的知識。除非你想要複習否則**你可以跳過這個計畫中所有的教學影片**。
[額外程式語言精進資源](programming-language-resources.md)
### C++
我沒讀過這兩本書但他們頗受好評。作者是Sedgewick他超讚的!
- [ ] [Algorithms in C++, Parts 1-4: Fundamentals, Data Structure, Sorting, Searching](https://www.amazon.com/Algorithms-Parts-1-4-Fundamentals-Structure/dp/0201350882/)
- [ ] [Algorithms in C++ Part 5: Graph Algorithms](https://www.amazon.com/Algorithms-Part-Graph-3rd-Pt-5/dp/0201361183/)
如果你有更好的C++書籍,請告訴我。我正在蒐集全面性的資源。
## Java
- [ ] [Algorithms (Sedgewick and Wayne)](https://www.amazon.com/Algorithms-4th-Robert-Sedgewick/dp/032157351X/)
- 在Coursera平台上有影片、書籍內容、(以及Sedgewick!)
- [Algorithms I](https://www.coursera.org/learn/algorithms-part1)
- [Algorithms II](https://www.coursera.org/learn/algorithms-part2)
或者:
- [ ] [Data Structures and Algorithms in Java](https://www.amazon.com/Data-Structures-Algorithms-Michael-Goodrich/dp/1118771338/)
- 作者:Goodrich、Tamassia、Goldwasser
- 被作為UC Berkeley資工系入門課程的補充教材
- 看看下面我對這本書的Python版的書評。兩本書都包含了相同的主題。
### Python
- [ ] [Data Structures and Algorithms in Python](https://www.amazon.com/Structures-Algorithms-Python-Michael-Goodrich/dp/1118290275/)
- 作者:Goodrich、Tamassia、Goldwasser
- 我超愛這本書。他包含了所有東西。
- 很Python的Code!
- 我的書評: https://startupnextdoor.com/book-report-data-structures-and-algorithms-in-python/
## 在你開始之前
這份清單隨著時間越來越大。當然,這也同時代表我越來越難以掌握他的整體內容。
以下是一些清單內的錯誤,希望能讓你避免這些錯誤,並且有更好的學習體驗。
### 1. 你沒辦法記住所有事情
我看了數小時的影片,同時也寫下了大量的筆記。但過了幾個月後,大部分的東西都消失的無影無蹤。我花了三天重新看過我的筆記,並做了小字卡幫助我複習他們。
請閱讀以下的文章以免重蹈覆轍:
[Retaining Computer Science Knowledge](https://startupnextdoor.com/retaining-computer-science-knowledge/).
有人推薦給我的課程(但我還沒看過:( ): [Learning how to Learn](https://www.coursera.org/learn/learning-how-to-learn)
### 2. 使用小字卡
為了解決剛剛提到的遺忘問題,我自己寫了一個小字卡網站。網站上可以新增兩種小字卡,一般的以及程式碼。
每一種類的小字卡都有不同的格式。
這個小字卡網站在製作時便是以行動裝置優先的方式設計的,好處是無論我在何處,我都可以在我的手機與平板上複習。
製作屬於自己的免費小字卡:
- [Flashcards site repo](https://github.com/jwasham/computer-science-flash-cards)
- [My flash cards database (old - 1200 cards)](https://github.com/jwasham/computer-science-flash-cards/blob/master/cards-jwasham.db):
- [My flash cards database (new - 1800 cards)](https://github.com/jwasham/computer-science-flash-cards/blob/master/cards-jwasham-extreme.db):
我的小字卡資料庫中包含了組合語言、Python的小知識、機器學習以及統計。這些內容已經超出了原本他的預設。
**關於小字卡**:當你第一次知道答案後,別馬上把那張小字卡標記為已知。反覆複習這張小字卡,直到每次都能答對後才是真正學會了這個問題。反覆的動作會讓這個知識深深地烙印在你的腦海內。
這裡有個替代我小字卡的網站[Anki](http://ankisrs.net/),很多人向我推薦過他。這個網站用同一個字卡重複出現的方式讓你牢牢地記住他。
這個網站非常容易使用支援多平台並且有雲端同步功能。在iOS平台上收費25美金其他平台免費。
這是我用Anki這個網站裡的格式所儲存的小字卡資料庫: https://ankiweb.net/shared/info/25173560 (感謝 [@xiewenya](https://github.com/xiewenya))
### 3. 學習資料結構與演算法的同時也要做一些Coding面試中常出現的問題
把你學過的東西應用在解題上面否則你很快就會忘了他們。這是一個過來人的經驗談。一旦你自認學會了一個主題像是Linked List之類的打開任何一本Coding面試問題書籍做一些裡面有關Linked List的問題。接著繼續讀後面的主題。然後再回頭反覆做有關Linked List、遞迴或者其他任何東西(原文為Recursion非Recursive)的題目。但切記一定在讀這些資料結構、演算法的同時,也要實際去寫一些有關這些東西的題目。公司錄取你是為了能有即戰力能夠上戰場,而非一個紙上談兵的人。這邊我覺得還不錯的書籍和網站。更多: [Coding Question Practice](#coding-question-practice)
### 4. 複習,複習,再複習
我自己寫了一些有關於ASCII Code、網路OSI模型、Big-O(時間複雜度)等等的小抄。我有空的時候就會把他們拿出來看一看複習一下。
打Code累了的話就休息半個小時並且複習你的小字卡。
### 5. 專注
能夠干擾你,浪費你寶貴時間的東西很多。因此,專注集中精神實在很難。放點純音樂能幫上一些忙。
## 這份清單沒有包含的內容
以下為普遍但沒有包含在這份清單內的技術:
- SQL
- Javascript
- HTML、CSS以及其他前後端的技術
## 每日計畫
每個主題所花費的時間都不盡相同,有些只要一天,有些需要花上數天。有些主題只有單純的知識而無包含實作。
每天我選擇下面其中一個主題,看跟該主題相關的影片,再用下面的程式語言實作:
- C - 用使用了struct *或者其他東西當作參數的struct以及函數
- C++ - 不要使用內建的東西
- C++ - 用C++內建的東西像是STL的Linked Liststd::list。
- Python - 使用內建的東西(為了練習Python)
- 寫一些測試來驗證自己寫的東西是正確的像是用assert()等簡單的方法。
- 你也可以用Java來練習上面只是我自己的方法。
你不需要學會所有的程式語言,你只需要專精在某個程式語言 [one language for the interview](#pick-one-language-for-the-interview).
為什麼要這樣寫Code?
- 練習練習再練習直到我對他產生厭惡感並且能輕鬆無誤地寫出那些Code。(有些東西需要特別記住,像是在邊界的時候會出現問題(edge cases),或者一些小細節)
- 全部自己來(像是手動分配/釋放記憶體不要依賴語言中的garbage collection的功能(除了Python或者Java))
- 利用語言中內建的東西及工具,之後在實際工作的時候才能得心應手(畢竟我不想在工作時手刻一個Linked List)。
我沒有時間做每個主題中的每個東西,但我會盡力而為。
下面是我自己寫的程式碼:
- [C](https://github.com/jwasham/practice-c)
- [C++](https://github.com/jwasham/practice-cpp)
- [Python](https://github.com/jwasham/practice-python)
你不需要記住每個演算法裡面的內容。
試試看把程式碼寫在白板或者紙上而不是電腦上。接著用一些測資來測試他。最後才用電腦來驗證。
## 先備知識
- [ ] **學習C++**
- C語言無所不在。在你學習的過程中幾乎任何一本書、課程或者影片中你都能看到他的身影。
- [ ] [C Programming Language, Vol 2](https://www.amazon.com/Programming-Language-Brian-W-Kernighan/dp/0131103628)
- 這本書還滿輕薄的但他能讓你有初步對於C語言的認識。看著這本書並且練習你能更快地掌握C語言。理解C語言能讓你更了解程式的運作以及內部記憶體配置。
- [answers to questions](https://github.com/lekkas/c-algorithms)
- [ ] **一個程式在電腦中是如何運作的:**
- [ ] [How CPU executes a program (video)](https://www.youtube.com/watch?v=XM4lGflQFvA)
- [ ] [How computers calculate - ALU (video)](https://youtu.be/1I5ZMmrOfnA)
- [ ] [Registers and RAM (video)](https://youtu.be/fpnE6UAfbtU)
- [ ] [The Central Processing Unit (CPU) (video)](https://youtu.be/FZGugFqdr60)
- [ ] [Instructions and Programs (video)](https://youtu.be/zltgXvg6r3k)
## 演算法複雜度(Algorithmic complexity) / Big-O / 漸進分析(Asymptotic analysis)
- 沒有任何東西能實作
- 這個主題有許多影片,看到你真正了解他為止。你可以隨時回來複習他。
- 如果這些課程太過數學的話,你可以去看看最下面離散數學的影片,他能讓你更了解這些數學背後的來源以及原理。
- [ ] [Harvard CS50 - Asymptotic Notation (video)](https://www.youtube.com/watch?v=iOq5kSKqeR4)
- [ ] [Big O Notations (general quick tutorial) (video)](https://www.youtube.com/watch?v=V6mKVRU1evU)
- [ ] [Big O Notation (and Omega and Theta) - best mathematical explanation (video)](https://www.youtube.com/watch?v=ei-A_wy5Yxw&index=2&list=PL1BaGV1cIH4UhkL8a9bJGG356covJ76qN)
- [ ] Skiena:
- [影片](https://www.youtube.com/watch?v=gSyDMtdPNpU&index=2&list=PLOtl7M3yp-DV69F32zdK7YJcNXpTunF2b)
- [投影片](http://www3.cs.stonybrook.edu/~algorith/video-lectures/2007/lecture2.pdf)
- [ ] [A Gentle Introduction to Algorithm Complexity Analysis](http://discrete.gr/complexity/)
- [ ] [Orders of Growth (video)](https://www.coursera.org/lecture/algorithmic-thinking-1/orders-of-growth-6PKkX)
- [ ] [Asymptotics (video)](https://www.coursera.org/lecture/algorithmic-thinking-1/asymptotics-bXAtM)
- [ ] [UC Berkeley Big O (video)](https://archive.org/details/ucberkeley_webcast_VIS4YDpuP98)
- [ ] [UC Berkeley Big Omega (video)](https://archive.org/details/ucberkeley_webcast_ca3e7UVmeUc)
- [ ] [Amortized Analysis (video)](https://www.youtube.com/watch?v=B3SpQZaAZP4&index=10&list=PL1BaGV1cIH4UhkL8a9bJGG356covJ76qN)
- [ ] [Illustrating "Big O" (video)](https://www.coursera.org/lecture/algorithmic-thinking-1/illustrating-big-o-YVqzv)
- [ ] TopCoder (includes recurrence relations and master theorem):
- [Computational Complexity: Section 1](https://www.topcoder.com/community/competitive-programming/tutorials/computational-complexity-section-1/)
- [Computational Complexity: Section 2](https://www.topcoder.com/community/competitive-programming/tutorials/computational-complexity-section-2/)
- [ ] [Cheat sheet](http://bigocheatsheet.com/)
## 資料結構
- ### 陣列
- 實作一個可以自動調整大小的陣列(動態陣列vector)
- [ ] (動態)陣列背後原理:
- [Arrays (video)](https://www.coursera.org/learn/data-structures/lecture/OsBSF/arrays)
- [UC Berkeley CS61B - Linear and Multi-Dim Arrays (video)](https://archive.org/details/ucberkeley_webcast_Wp8oiO_CZZE) (Start watching from 15m 32s)
- [Basic Arrays (video)](https://archive.org/details/0102WhatYouShouldKnow/02_04-basicArrays.mp4)
- [Multi-dim (video)](https://archive.org/details/0102WhatYouShouldKnow/02_05-multidimensionalArrays.mp4)
- [Dynamic Arrays (video)](https://www.coursera.org/learn/data-structures/lecture/EwbnV/dynamic-arrays)
- [Jagged Arrays (video)](https://www.youtube.com/watch?v=1jtrQqYpt7g)
- [Jagged Arrays (video)](https://archive.org/details/0102WhatYouShouldKnow/02_06-jaggedArrays.mp4)
- [Resizing arrays (video)](https://archive.org/details/0102WhatYouShouldKnow/03_01-resizableArrays.mp4)
- [ ] 實作動態陣列(可變、可動態調整大小的陣列)
- [ ] 練習在程式中用陣列以及指標,透過計算指標而存取該內容,而不是直接用索引。
- [ ] 直接動態生成一個新的陣列
- 可以生成一個int型別的陣列但不要使用語言提供的功能
- 從16或者更大的數開始寫像是2的次方 - 16、32、64、128。
- [ ] size() - 陣列中元素個數
- [ ] capacity() - 陣列能存的最大元素個數
- [ ] is_empty()
- [ ] at(index) - 傳回該索引值的元素,附有邊界檢查(boundary check)
- [ ] push(item)
- [ ] insert(index, item) - 把元素插入該索引值,把原本在該索引值的元素往右邊移動。
- [ ] prepend(item) - 可以把元素插入索引值為0的地方。
- [ ] pop() - 移除陣列中最後一個元素,並回傳該元素的值。
- [ ] delete(index) - 刪除在該索引值的元素,並且把右邊剩下元素全部往左移。
- [ ] remove(item) - 從陣列中尋找該數值,並且移除他(就算陣列中數個地方都有這個數值)。
- [ ] find(item) - 從陣列中尋找該數值,並且傳回最前面找到該數值的索引值,如果沒有則傳回-1。
- [ ] resize(nex_capacity) // private function
- 當陣列已經用盡了所有容量後,把陣列的容量*2。
- 如果移除掉一個元素後陣列實際大小是最大容量的1/4則把陣列容量減半。
- [ ] 時間複雜度
- O(1) 在陣列末端插入/刪除元素
- O(n) 在任何地方插入/刪除元素
- [ ] 空間複雜度
- 在記憶體中的存放位置是連續的,這種儲存方式有助於存取的性能。
- 所需空間 = (陣列容量,>=n) * 元素所需大小但就算結果為2n實際上仍算成O(n)
- ### Linked Lists
- [ ] Linked Lists背後原理:
- [ ] [Singly Linked Lists (video)](https://www.coursera.org/learn/data-structures/lecture/kHhgK/singly-linked-lists)
- [ ] [CS 61B - Linked Lists 1 (video)](https://archive.org/details/ucberkeley_webcast_htzJdKoEmO0)
- [ ] [CS 61B - Linked Lists 2 (video)](https://archive.org/details/ucberkeley_webcast_-c4I3gFYe3w)
- [ ] [C Code (video)](https://www.youtube.com/watch?v=QN6FPiD0Gzo)
- 沒有完整的code裡面只包含了用struct實作節點的方式以及其記憶體配置。
- [ ] Linked List vs 陣列:
- [Core Linked Lists Vs Arrays (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/rjBs9/core-linked-lists-vs-arrays)
- [In The Real World Linked Lists Vs Arrays (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/QUaUd/in-the-real-world-lists-vs-arrays)
- [ ] [why you should avoid linked lists (video)](https://www.youtube.com/watch?v=YQs6IC-vgmo)
- [ ] 小心!: 你需要一些關於指標的指標(Pointer to pointer)的知識:
(當你回傳一個指標到函式,這個動作可能會改變指標所指向的地址)
這個頁面僅提供基本對於指標的指標的認識。我不推薦這個遍歷linked list的方式因為他用的方式太過神奇所以可讀性以及維護性並不好。
- [Pointers to Pointers](https://www.eskimo.com/~scs/cclass/int/sx8.html)
- [ ] 實作Linked list (我做了有末端指標(tail pointer)的版本以及無末端指標的版本):
- [ ] size() - 回傳linked list裡面的元素個數
- [ ] empty() - 回傳型態:bool如果linked list為空回傳true
- [ ] value_at(index) - 回傳索引值為index的元素的數值第一個元素索引值為0以此類推
- [ ] push_front(value) - 從linked list的起始點加入新的元素
- [ ] pop_front() - 移除第一個元素,並且回傳該元素的數值
- [ ] push_back(value) - 在linked list末端加入新元素
- [ ] pop_back() - 移除最後一個元素,並且回傳該元素的數值
- [ ] front() - 回傳第一個元素的數值
- [ ] back() - 回傳最後一個元素的數值
- [ ] insert(index, value) - 把新元素插入到該索引值,而新元素指向原本在該索引值的元素。
- [ ] erase(index) - 刪除該索引值的元素(節點)
- [ ] value_n_from_end(n) - 回傳從末端開始計算的第n個元素的數值
- [ ] reverse() - 反轉該linked list
- [ ] remove_value(value) - 刪除第一個為該數值的元素(意即7 2 2 1要刪除2的話只刪除index:1的那個2)
- [ ] 雙向linked List
- [背後原理(影片)](https://www.coursera.org/learn/data-structures/lecture/jpGKD/doubly-linked-lists)
- 不需實作
- ### Stack(堆疊)
- [ ] [Stacks(影片)](https://www.coursera.org/learn/data-structures/lecture/UdKzQ/stacks)
- [ ] [使用Stacks先進後出(Last-In First-Out)(影片)](https://archive.org/details/0102WhatYouShouldKnow/05_01-usingStacksForLast-inFirst-out.mp4)
- [ ] 無須實作,可以用陣列實作,但這樣太過簡單了。
- ### Queue(佇列)
- [ ] [使用Queues(先進先出)First-In First-Out(影片)](https://archive.org/details/0102WhatYouShouldKnow/05_03-usingQueuesForFirst-inFirst-out.mp4)
- [ ] [Queue(影片)](https://www.coursera.org/lecture/data-structures/queues-EShpq)
- [ ] [Circular buffer/FIFO](https://en.wikipedia.org/wiki/Circular_buffer)
- [ ] [Priority Queues(影片)](https://archive.org/details/0102WhatYouShouldKnow/05_04-priorityQueuesAndDeques.mp4)
- [ ] 使用linked list實作包含末端指標(tail pointer):
- enqueue(value) - 在queue末端加入元素
- dequeue() - 刪除當時queue中最早進入的元素(意即queue中第一個元素),並且回傳該元素的值。
- empty()
- full()
- [ ] 複雜度:
-
- enqueue: O(1) (平均情況無論對於用linked list或陣列實作的方法)
- dequeue: O(1) (linked list與陣列)
- empty: O(1) (linked list與陣列)
- ### 雜湊表(Hash table)
- [ ] 影片:
- [ ] [Hashing with Chaining (video)](https://www.youtube.com/watch?v=0M_kIqhwbFo&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=8)
- [ ] [Table Doubling, Karp-Rabin (video)](https://www.youtube.com/watch?v=BRO7mVIFt08&index=9&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb)
- [ ] [Open Addressing, Cryptographic Hashing (video)](https://www.youtube.com/watch?v=rvdJDijO2Ro&index=10&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb)
- [ ] [PyCon 2010: The Mighty Dictionary (video)](https://www.youtube.com/watch?v=C4Kc8xzcA68)
- [ ] [(Advanced) Randomization: Universal & Perfect Hashing (video)](https://www.youtube.com/watch?v=z0lJ2k0sl1g&list=PLUl4u3cNGP6317WaSNfmCvGym2ucw3oGp&index=11)
- [ ] [(Advanced) Perfect hashing (video)](https://www.youtube.com/watch?v=N0COwN14gt0&list=PL2B4EEwhKD-NbwZ4ezj7gyc_3yNrojKM9&index=4)
- [ ] 線上開放式課程:
- [ ] [Understanding Hash Functions (video)](https://archive.org/details/0102WhatYouShouldKnow/06_02-understandingHashFunctions.mp4)
- [ ] [Using Hash Tables (video)](https://archive.org/details/0102WhatYouShouldKnow/06_03-usingHashTables.mp4)
- [ ] [Supporting Hashing (video)](https://archive.org/details/0102WhatYouShouldKnow/06_04-supportingHashing.mp4)
- [ ] [Language Support Hash Tables (video)](https://archive.org/details/0102WhatYouShouldKnow/06_05-languageSupportForHashTables.mp4)
- [ ] [Core Hash Tables (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/m7UuP/core-hash-tables)
- [ ] [Data Structures (video)](https://www.coursera.org/learn/data-structures/home/week/3)
- [ ] [Phone Book Problem (video)](https://www.coursera.org/learn/data-structures/lecture/NYZZP/phone-book-problem)
- [ ] 分散式雜湊表(distributed hash table):
- [Instant Uploads And Storage Optimization In Dropbox (video)](https://www.coursera.org/learn/data-structures/lecture/DvaIb/instant-uploads-and-storage-optimization-in-dropbox)
- [Distributed Hash Tables (video)](https://www.coursera.org/learn/data-structures/lecture/tvH8H/distributed-hash-tables)
- [ ] 實作雜湊表(用陣列以及線性探測(linear probing))
- hash(k, m) - m:雜湊表的大小
- add(key, value) - 如果key已經存在則更新該key的value
- exists(key)
- get(key)
- remove(key)
## 更多
- ### 二分搜尋法(Binary Search)
- [ ] [二分搜尋法(影片)](https://www.youtube.com/watch?v=D5SrAga1pno)
- [ ] [二分搜尋法(影片)](https://www.khanacademy.org/computing/computer-science/algorithms/binary-search/a/binary-search)
- [ ] [細節](https://www.topcoder.com/community/competitive-programming/tutorials/binary-search/)
- [ ] 實作:
- 二分搜尋法 (對已經排列好的數列)
- 用遞迴(recursion)的方法實作二分搜尋法
- ### 位元運算(Bitwise operations)
- [ ] [Bits cheat sheet](https://github.com/jwasham/coding-interview-university/blob/master/extras/cheat%20sheets/bits-cheat-cheet.pdf) - you should know many of the powers of 2 from (2^1 to 2^16 and 2^32)
- [ ] 實際了解如何用下列的位元運算子來操作每個位元: &, |, ^, ~, >>, <<
- [ ] [words](https://en.wikipedia.org/wiki/Word_(computer_architecture))
- [ ] Good intro:
[Bit Manipulation (video)](https://www.youtube.com/watch?v=7jkIUgLC29I)
- [ ] [C Programming Tutorial 2-10: Bitwise Operators (video)](https://www.youtube.com/watch?v=d0AwjSpNXR0)
- [ ] [Bit Manipulation](https://en.wikipedia.org/wiki/Bit_manipulation)
- [ ] [Bitwise Operation](https://en.wikipedia.org/wiki/Bitwise_operation)
- [ ] [Bithacks](https://graphics.stanford.edu/~seander/bithacks.html)
- [ ] [The Bit Twiddler](https://bits.stephan-brumme.com/)
- [ ] [The Bit Twiddler Interactive](https://bits.stephan-brumme.com/interactive.html)
- [ ] 一補數與二補數
- [Binary: Plusses & Minuses (Why We Use Two's Complement) (video)](https://www.youtube.com/watch?v=lKTsv6iVxV4)
- [1s Complement](https://en.wikipedia.org/wiki/Ones%27_complement)
- [2s Complement](https://en.wikipedia.org/wiki/Two%27s_complement)
- [ ] count set bits
- [4 ways to count bits in a byte (video)](https://youtu.be/Hzuzo9NJrlc)
- [Count Bits](https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan)
- [How To Count The Number Of Set Bits In a 32 Bit Integer](http://stackoverflow.com/questions/109023/how-to-count-the-number-of-set-bits-in-a-32-bit-integer)
- [ ] swap values:
- [Swap](https://bits.stephan-brumme.com/swap.html)
- [ ] 絕對值:
- [Absolute Integer](https://bits.stephan-brumme.com/absInteger.html)
## 樹狀結構(Tree)
- ### Trees - 重點與背景知識
- [ ] [Series: Core Trees (影片)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/ovovP/core-trees)
- [ ] [Series: Trees (影片)](https://www.coursera.org/learn/data-structures/lecture/95qda/trees)
- basic tree construction
- traversal
- manipulation algorithms
- [ ] [BFS(breadth-first search) and DFS(depth-first search) (影片)](https://www.youtube.com/watch?v=uWL6FJhq5fM)
- BFS(廣度優先搜尋)重點:
- 每一層的順序(BFS用queue)
- 時間複雜度: O(n)
- 空間複雜度: 最佳: O(1), 最糟: O(n/2)=O(n)
- DFS(深度優先搜尋)重點:
- 時間複雜度: O(n)
- 空間複雜度:
最佳: O(log n) - 平均. 樹的高度
最糟: O(n)
- 中序 (DFS: 左子樹、根、右子樹)
- 後序 (DFS: 左子樹、右子樹、根)
- 前序 (DFS: 根、左子樹、右子樹)
- ### (二元搜尋樹)Binary search trees: BSTs
- [ ] [Binary Search Tree Review (video)](https://www.youtube.com/watch?v=x6At0nzX92o&index=1&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6)
- [ ] [Series (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/p82sw/core-introduction-to-binary-search-trees)
- starts with symbol table and goes through BST applications
- [ ] [Introduction (video)](https://www.coursera.org/learn/data-structures/lecture/E7cXP/introduction)
- [ ] [MIT (video)](https://www.youtube.com/watch?v=9Jry5-82I68)
- C/C++:
- [ ] [Binary search tree - Implementation in C/C++ (video)](https://www.youtube.com/watch?v=COZK7NATh4k&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P&index=28)
- [ ] [BST implementation - memory allocation in stack and heap (video)](https://www.youtube.com/watch?v=hWokyBoo0aI&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P&index=29)
- [ ] [Find min and max element in a binary search tree (video)](https://www.youtube.com/watch?v=Ut90klNN264&index=30&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P)
- [ ] [Find height of a binary tree (video)](https://www.youtube.com/watch?v=_pnqMz5nrRs&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P&index=31)
- [ ] [Binary tree traversal - breadth-first and depth-first strategies (video)](https://www.youtube.com/watch?v=9RHO6jU--GU&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P&index=32)
- [ ] [Binary tree: Level Order Traversal (video)](https://www.youtube.com/watch?v=86g8jAQug04&index=33&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P)
- [ ] [Binary tree traversal: Preorder, Inorder, Postorder (video)](https://www.youtube.com/watch?v=gm8DUJJhmY4&index=34&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P)
- [ ] [Check if a binary tree is binary search tree or not (video)](https://www.youtube.com/watch?v=yEwSGhSsT0U&index=35&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P)
- [ ] [Delete a node from Binary Search Tree (video)](https://www.youtube.com/watch?v=gcULXE7ViZw&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P&index=36)
- [ ] [Inorder Successor in a binary search tree (video)](https://www.youtube.com/watch?v=5cPbNCrdotA&index=37&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P)
- [ ] 實作:
- [ ] insert // 把數值插入到二元搜尋樹當中
- [ ] get_node_count // get count of values stored
- [ ] print_values // 把二元搜尋樹中的數值從小到大輸出
- [ ] delete_tree
- [ ] is_in_tree // 如果給定的數值位於二元搜尋樹當中則回傳true
- [ ] get_height // 回傳該節點內的高度(單一節點的樹高度為1)
- [ ] get_min // 回傳二元搜尋樹當中的最小值
- [ ] get_max // 回傳二元搜尋樹當中的最大值
- [ ] is_binary_search_tree
- [ ] delete_value
- [ ] get_successor // 回傳二元搜尋樹當中大小在給定數值後一位的數值,如果沒有則回傳-1
- ### Heap / Priority Queue / Binary Heap
- 一般將此資料結構以樹的方式視覺化,但實際上是以線性的方式儲存(陣列、linked list)
- [ ] [Heap](https://en.wikipedia.org/wiki/Heap_(data_structure))
- [ ] [Introduction (video)](https://www.coursera.org/learn/data-structures/lecture/2OpTs/introduction)
- [ ] [Naive Implementations (video)](https://www.coursera.org/learn/data-structures/lecture/z3l9N/naive-implementations)
- [ ] [Binary Trees (video)](https://www.coursera.org/learn/data-structures/lecture/GRV2q/binary-trees)
- [ ] [Tree Height Remark (video)](https://www.coursera.org/learn/data-structures/supplement/S5xxz/tree-height-remark)
- [ ] [Basic Operations (video)](https://www.coursera.org/learn/data-structures/lecture/0g1dl/basic-operations)
- [ ] [Complete Binary Trees (video)](https://www.coursera.org/learn/data-structures/lecture/gl5Ni/complete-binary-trees)
- [ ] [Pseudocode (video)](https://www.coursera.org/learn/data-structures/lecture/HxQo9/pseudocode)
- [ ] [Heap Sort - jumps to start (video)](https://youtu.be/odNJmw5TOEE?list=PLFDnELG9dpVxQCxuD-9BSy2E7BWY3t5Sm&t=3291)
- [ ] [Heap Sort (video)](https://www.coursera.org/learn/data-structures/lecture/hSzMO/heap-sort)
- [ ] [Building a heap (video)](https://www.coursera.org/learn/data-structures/lecture/dwrOS/building-a-heap)
- [ ] [MIT: Heaps and Heap Sort (video)](https://www.youtube.com/watch?v=B7hVxCmfPtM&index=4&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb)
- [ ] [CS 61B Lecture 24: Priority Queues (video)](https://archive.org/details/ucberkeley_webcast_yIUFT6AKBGE)
- [ ] [Linear Time BuildHeap (max-heap)](https://www.youtube.com/watch?v=MiyLo8adrWw)
- [ ] 實作max heap:
- [ ] insert
- [ ] sift_up - needed for insert
- [ ] get_max - returns the max item, without removing it
- [ ] get_size() - return number of elements stored
- [ ] is_empty() - returns true if heap contains no elements
- [ ] extract_max - returns the max item, removing it
- [ ] sift_down - needed for extract_max
- [ ] remove(i) - removes item at index x
- [ ] heapify - create a heap from an array of elements, needed for heap_sort
- [ ] heap_sort() - take an unsorted array and turn it into a sorted array in-place using a max heap
- 重點: using a min heap instead would save operations, but double the space needed (cannot do in-place).
## 排序