Trees, BST

This commit is contained in:
Evgeniy Ilyushin 2018-01-10 08:43:46 +03:00
parent 41efccb339
commit 964b27f023

View File

@ -739,59 +739,59 @@ Google не возьмёт тебя на работу.
- [ ] абсолютные значения: - [ ] абсолютные значения:
- [Absolute Integer](http://bits.stephan-brumme.com/absInteger.html) - [Absolute Integer](http://bits.stephan-brumme.com/absInteger.html)
## Trees ## Деревья
- ### Trees - Notes & Background - ### Деревья - Заметки & Основные понятия
- [ ] [Series: Core Trees (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/ovovP/core-trees) - [ ] [Основы деревьев (видео)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/ovovP/core-trees)
- [ ] [Series: Trees (video)](https://www.coursera.org/learn/data-structures/lecture/95qda/trees) - [ ] [Деревья (видео)](https://www.coursera.org/learn/data-structures/lecture/95qda/trees)
- basic tree construction - базовые конструкции деревьев
- traversal - обход
- manipulation algorithms - алгоритмы манипуляции
- BFS (breadth-first search) - BFS (breadth-first search - поиск в ширину)
- [MIT (video)](https://www.youtube.com/watch?v=s-CYnVz-uh4&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=13) - [MIT (видео)](https://www.youtube.com/watch?v=s-CYnVz-uh4&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=13)
- level order (BFS, using queue) - порядок уровня (BFS, использование очереди)
time complexity: O(n) сложность по времени выполнения: O(n)
space complexity: best: O(1), worst: O(n/2)=O(n) сложность по памяти: лучшая: O(1), худшая: O(n/2)=O(n)
- DFS (depth-first search) - DFS (depth-first search - поиск в глубину)
- [MIT (video)](https://www.youtube.com/watch?v=AfSk24UTFS8&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=14) - [MIT (видео)](https://www.youtube.com/watch?v=AfSk24UTFS8&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=14)
- notes: - заметки:
time complexity: O(n) сложность по времени выполнения: O(n)
space complexity: сложность по памяти:
best: O(log n) - avg. height of tree лучшая: O(log n) - средняя высота дерева
worst: O(n) худшая: O(n)
- inorder (DFS: left, self, right) - in-order (DFS: левый, вершина, правый)
- postorder (DFS: left, right, self) - post-order (DFS: левый, правый, вершина)
- preorder (DFS: self, left, right) - pre-order (DFS: вершина, левый, правый)
- ### Binary search trees: BSTs - ### Бинарное дерево поиска(Binary search trees): BSTs
- [ ] [Binary Search Tree Review (video)](https://www.youtube.com/watch?v=x6At0nzX92o&index=1&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6) - [ ] [Обзор бинарного дерева поиска (видео)](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) - [ ] [Лекции (видео)](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 - начинается с таблицы символов и заканчивая BST приложениями
- [ ] [Introduction (video)](https://www.coursera.org/learn/data-structures/lecture/E7cXP/introduction) - [ ] [Введение (видео)](https://www.coursera.org/learn/data-structures/lecture/E7cXP/introduction)
- [ ] [MIT (video)](https://www.youtube.com/watch?v=9Jry5-82I68) - [ ] [MIT (видео)](https://www.youtube.com/watch?v=9Jry5-82I68)
- C/C++: - C/C++:
- [ ] [Binary search tree - Implementation in C/C++ (video)](https://www.youtube.com/watch?v=COZK7NATh4k&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P&index=28) - [ ] [Бинарное дерево поиска - реализация на C/C++ (видео)](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) - [ ] [BST реализация - аллокация памяти в стеке и куче (видео)](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) - [ ] [Поиск минимального и максимального элемента в BST (видео)](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) - [ ] [Нахождение высоты BST (видео)](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) - [ ] [Обход BST - breadth-first и depth-first стратегии (видео)](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) - [ ] [Бинарное дерево: обход по уровням (видео)](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) - [ ] [Обход бинарного дерева: Pre-order, In-order, Post-order (видео)](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) - [ ] [Проверка - бинарное дерево BST или нет (видео)](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) - [ ] [Удаление узов в BST (видео)](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) - [ ] [In-order аналог в BST (видео)](https://www.youtube.com/watch?v=5cPbNCrdotA&index=37&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P)
- [ ] Implement: - [ ] Реализация:
- [ ] insert // insert value into tree - [ ] insert // вставка значения в дерево
- [ ] get_node_count // get count of values stored - [ ] get_node_count // получение количества хранящихся значений
- [ ] print_values // prints the values in the tree, from min to max - [ ] print_values // вывод значений, начиная с min к max
- [ ] delete_tree - [ ] delete_tree
- [ ] is_in_tree // returns true if given value exists in the tree - [ ] is_in_tree // возвращает если переданное значение есть в дереве
- [ ] get_height // returns the height in nodes (single node's height is 1) - [ ] get_height // возвращает высоту дерева в количестве узлов (высота одного узла 1)
- [ ] get_min // returns the minimum value stored in the tree - [ ] get_min // возвращает минимальное значение хранящиеся в узлах дерева
- [ ] get_max // returns the maximum value stored in the tree - [ ] get_max // возвращает максимальное значение хранящиеся в узлах дерева
- [ ] is_binary_search_tree - [ ] is_binary_search_tree
- [ ] delete_value - [ ] delete_value
- [ ] get_successor // returns next-highest value in tree after given value, -1 if none - [ ] get_successor // возвращает следующее максимальное значение в дереве после переданного, -1 если none
- ### Heap / Priority Queue / Binary Heap - ### Heap / Priority Queue / Binary Heap
- visualized as a tree, but is usually linear in storage (array, linked list) - visualized as a tree, but is usually linear in storage (array, linked list)