# Data Structure and Algorithm Playbook: Insights and Codes
```
Author: Howard Kuo
```
:::success
This note is serve as my personal note repository but also demonstration of my learning and a **practical, hands-on approach of homeworks** . Log in to post comments or suggest corrections. I welcome your feedback!
:::
# Motivation:
When you're learning algorithm, it is not like linear algebra sort of thing :(

[Iteration vs recursion, courtesy of freecodecamp](
https://www.freecodecamp.org/news/how-recursion-works-explained-with-flowcharts-and-a-video-de61f40cb7f9)
## The Challenge of Algorithms
When you learn **Linear Algebra**, you learn to solve systems of equations. It is procedural:
**You turn the crank on row reduction technology, and out pops an answer.**

**Algorithms** are different. There is no general procedure or machine to do the work for you.
### You have to come up with a clever idea
> 
Because there is no fixed recipe, algorithms remain an active field of research with many new things yet to be discovered.
## Learning Resource
- Introduction to Algorithms, 3rd edition, MIT press. By Cormen, Leiserson, Rivest, and Stein.
- Data Structure and Algorithm: Daniel M. Kane, Alexander Kulikov, Pavel Pevzner, Michael Levin, and Neil Rhodes, from UC San Diego and HSE University.
## Three of the most common and most generally applicable algorithmic design techniques.
1. Greedy algorithms.
2. Divide and Conquer
3. Dynamic Programming
## Level of Design
* **Naive Algorithm** : Definition of algorithm, slow (e.g: Fibonacci Summation)
* **Algorithm by ways of standard Tools**: Standard techniques
* **Optimized Algorithm**: Improve existing algorithm
-----
# Table of Contents
- [ch1. Recursive Programming Challenges](https://medium.com/@howard900126/data-structures-algorithms-notes-eef86591dcc0?postPublishedType=repub)
- [ch1.1 Algorithm workup](https://hackmd.io/WfYPty0IScOOnT4u6rw6Bw)
- [GitCode Answer](https://github.com/Howarkuo/DataStructure_in_Python3/tree/main/Week2-AlgorithmWarmUp)
- **2-2 Last Digit of the Fibonacci Numbers**
- **2-3 Greatest Common Divisor** -KEY: EUCLIDEAN ALGORITHM
- **2-4 Least Common Multiple** -KEY: RELATIONSHIP OF GCD AND LCM
- **2-5 Huge Fibonacci Number** -KEY: ITERATION OF PISANO PERIOD
- **2-6 Last Digit of the Partial Sum of Fibonacci Numbers** -KEY: ITERATION BUT NOT RECURSION
- **2-7 Last Digit of the Sum of Fibonacci Numbers** -KEY: DO SUM(mod10), (Cycle of Pisano PERIOD: 60)
- **2-8 Last Digit of the Sum of squares of Fibonacci Numbers** -KEY: SUM OF SQUARE IS PRODUCT OF CURRENT AND NEXT FIB NUMB
- > For Instance: Use the iteration nature of Pisano sequence to reduce the dimension of Fibonacci squence

- [ch2. Performance Analysis](https://hackmd.io/qQiHOv5XTgW31OmKwkMAGg)
- [ch2.1 Visualize Big O plot of functions: Google Colab Demo](https://colab.research.google.com/drive/1HUOtDmb9OWRRBEawgQXp5yjHl6XPEpZ-?usp=sharing)
- [Ch3. Core Algorithms]
- [ch3.1: Greedy Algorithms ](https://hackmd.io/3tLxyUW_RRGhy7syFhPCGw?view)
- [ch3.2: Divide and Conquer]()
- [ch3.3: Dynamic Programming]
- [Ch4.Data Structures]
- [ch4.1: Basic Data Structures: Bracketws, Tree Height, Packets ]
- [ch4.2: Dynamic Arrays and Amortized Analysis ]
- [ch4.3: Priority Queues: Heaps conversion, Parallel Processing- Tress sorts/Heap Sorts ]
- [ch4.4: Disjoint Sets ]
- [ch4.5: Hash Tables ]
- [Ch5.Advanced Trees, Sorting, and Graphs]
- [Binary Search Trees]
- [AVL Trees, Red-Black, Splay adn Huffman Trees, Multi-way Search Trees, B+ & 2-3 Trees ]
- [Bubble, Insertion, Selection & Tree Sorts]
- [Merge, Quick & Radix Sorts]
- [Undirected & Directed Graphs, Advanced Graphs, Shortest Path Algorithms]
-----