Add content for tries and balanced search trees

pull/2907/head
Kamran Ahmed 2 years ago
parent e7a2e027e5
commit 51a543f013
  1. 13
      content/roadmaps/103-computer-science/content/114-tries.md
  2. 12
      content/roadmaps/103-computer-science/content/115-balanced-search-trees/100-avl-trees.md
  3. 15
      content/roadmaps/103-computer-science/content/115-balanced-search-trees/101-red-black-trees.md
  4. 11
      content/roadmaps/103-computer-science/content/115-balanced-search-trees/102-the-2-3-search-trees.md
  5. 8
      content/roadmaps/103-computer-science/content/115-balanced-search-trees/103-the-2-3-4-trees.md
  6. 11
      content/roadmaps/103-computer-science/content/115-balanced-search-trees/104-n-ary-trees.md
  7. 15
      content/roadmaps/103-computer-science/content/115-balanced-search-trees/105-b-tree.md
  8. 10
      content/roadmaps/103-computer-science/content/115-balanced-search-trees/readme.md

@ -1 +1,14 @@
# Tries
Tries are a data structure that can be used to store strings. The idea is to store the characters of the string in a tree-like structure, where each node of the tree represents a single character. We can use this structure to store strings in a way that allows us to quickly search for strings with a common prefix.
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='yellow' badgeText='Read' href='http://www.cs.yale.edu/homes/aspnes/classes/223/notes.html#Tries'>Tries - DataStructure Notes</BadgeLink>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.toptal.com/java/the-trie-a-neglected-data-structure'>The Trie: A Neglected Data Structure</BadgeLink>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.topcoder.com/thrive/articles/Using%20Tries'>TopCoder - Using Tries</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=TJ8SkcUSdbU'>Stanford Lecture (real world use case)</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=NinWEPPrkDQ&index=16&list=PLUl4u3cNGP61hsJNdULdudlRL493b-XZf'>MIT, Advanced Data Structures, Strings (can get pretty obscure about halfway through)</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.coursera.org/learn/algorithms-part2/home/week/4'>0. Tries - Coursera</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.coursera.org/learn/algorithms-part2/lecture/CPVdr/r-way-tries'>1. R Way Tries</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.coursera.org/learn/algorithms-part2/lecture/yQM8K/ternary-search-tries'>2. Ternary Search Tries</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.coursera.org/learn/algorithms-part2/lecture/jwNmV/character-based-operations'>3. Character Based Operations</BadgeLink>

@ -1 +1,11 @@
# Avl trees
# AVL Trees
AVL trees are a type of self-balancing binary search tree. They are named after their inventors, Adelson-Velskii and Landis. AVL trees are the most popular self-balancing binary search tree.
In practice: From what I can tell, these aren't used much in practice, but I could see where they would be: The AVL tree is another structure supporting O(log n) search, insertion, and removal. It is more rigidly balanced than red–black trees, leading to slower insertion and removal but faster retrieval. This makes it attractive for data structures that may be built once and loaded without reconstruction, such as language dictionaries (or program dictionaries, such as the opcodes of an assembler or interpreter)
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=FNeL18KsWPc&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=6'>MIT AVL Trees / AVL Sort</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.coursera.org/learn/data-structures/lecture/Qq5E0/avl-trees'>AVL Trees</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.coursera.org/learn/data-structures/lecture/PKEBC/avl-tree-implementation'>AVL Tree Implementation</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.coursera.org/learn/data-structures/lecture/22BgE/split-and-merge'>Split And Merge</BadgeLink>

@ -1 +1,14 @@
# Red black trees
# Red/Black Trees
In computer science, a red–black tree is a kind of self-balancing binary search tree. Each node stores an extra bit representing "color", used to ensure that the tree remains balanced during insertions and deletions.
These are a translation of a 2-3 tree (see below).
In practice: Red–black trees offer worst-case guarantees for insertion time, deletion time, and search time. Not only does this make them valuable in time-sensitive applications such as real-time applications, but it makes them valuable building blocks in other data structures which provide worst-case guarantees; for example, many data structures used in computational geometry can be based on red–black trees, and the Completely Fair Scheduler used in current Linux kernels uses red–black trees. In the version 8 of Java, the Collection HashMap has been modified such that instead of using a LinkedList to store identical elements with poor hashcodes, a Red-Black tree is used.
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://en.wikipedia.org/wiki/Red%E2%80%93black_tree'>Red-Black Tree - Wikipedia</BadgeLink>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.topcoder.com/thrive/articles/An%20Introduction%20to%20Binary%20Search%20and%20Red-Black%20Trees'>An Introduction To Binary Search And Red Black Tree</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/playlist?list=PL9xmBV_5YoZNqDI8qfOZgzbqahCUmUEin'>Red-Black Trees (playlist) in 30 minutes</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://youtu.be/1W3x0f_RmUo?list=PLFDnELG9dpVxQCxuD-9BSy2E7BWY3t5Sm&t=3871'>Aduni - Algorithms - Lecture 4 (link jumps to starting point)</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=hm2GHwyKF1o&list=PLFDnELG9dpVxQCxuD-9BSy2E7BWY3t5Sm&index=5'>Aduni - Algorithms - Lecture 5</BadgeLink>

@ -1 +1,10 @@
# The 2 3 search trees
# 2-3 Search Trees
In practice: 2-3 trees have faster inserts at the expense of slower searches (since height is more compared to AVL trees).
You would use 2-3 tree very rarely because its implementation involves different types of nodes. Instead, people use Red Black trees.
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=C3SsdUqasD4&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6&index=2'>23-Tree Intuition and Definition</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=iYvBtGKsqSg&index=3&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6'>Binary View of 23-Tree</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=TOb1tuEZ2X4&index=5&list=PLUl4u3cNGP6317WaSNfmCvGym2ucw3oGp'>2-3 Trees (student recitation)</BadgeLink>

@ -1 +1,7 @@
# The 2 3 4 trees
# 2-3-4 Search Trees
In practice: For every 2-4 tree, there are corresponding red–black trees with data elements in the same order. The insertion and deletion operations on 2-4 trees are also equivalent to color-flipping and rotations in red–black trees. This makes 2-4 trees an important tool for understanding the logic behind red–black trees, and this is why many introductory algorithm texts introduce 2-4 trees just before red–black trees, even though 2-4 trees are not often used in practice.
<BadgeLink colorScheme='red' badgeText='Watch' href='https://archive.org/details/ucberkeley_webcast_zqrqYXkth6Q'>CS 61B Lecture 26: Balanced Search Trees</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=DQdMYevEyE4&index=4&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6'>Bottom Up 234-Trees</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=2679VQ26Fp4&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6&index=5'>Top Down 234-Trees</BadgeLink>

@ -1 +1,10 @@
# N ary trees
# N-ary (K-ary, M-ary) Trees
Note: the N or K is the branching factor (max branches)
Binary trees are a 2-ary tree, with branching factor = 2
2-3 trees are 3-ary
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://en.wikipedia.org/wiki/K-ary_tree'>K-Ary Tree</BadgeLink>

@ -1 +1,14 @@
# B tree
# B-Trees
Fun fact: it's a mystery, but the B could stand for Boeing, Balanced, or Bayer (co-inventor).
In Practice: B-Trees are widely used in databases. Most modern filesystems use B-trees (or Variants). In addition to its use in databases, the B-tree is also used in filesystems to allow quick random access to an arbitrary block in a particular file. The basic problem is turning the file block i address into a disk block (or perhaps to a cylinder-head-sector) address
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://en.wikipedia.org/wiki/B-tree'>B-Tree - Wikipedia</BadgeLink>
<BadgeLink colorScheme='yellow' badgeText='Read' href='http://btechsmartclass.com/data_structures/b-trees.html'>B-Tree Datastructure</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=I22wEC1tTGo&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6&index=6'>Introduction to B-Trees</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=s3bCdZGrgpA&index=7&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6'>B-Tree Definition and Insertion</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=svfnVhJOfMc&index=8&list=PLA5Lqm4uh9Bbq-E0ZnqTIa8LRaL77ica6'>B-Tree Deletion</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=V3omVLzI0WE&index=7&list=PLUl4u3cNGP61hsJNdULdudlRL493b-XZf'>MIT 6.851 - Memory Hierarchy Models</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/playlist?list=PL9xmBV_5YoZNFPPv98DjTdD9X6UI9KMHz'>B-Trees (playlist) in 26 minutes</BadgeLink>

@ -1 +1,9 @@
# Balanced search trees
# Balanced Search Trees
Balanced search trees are a type of data structure that allow for fast insertion, deletion, and lookup of data. They are a type of self-balancing binary search tree, which means that they are a binary tree that maintains the binary search tree property while also keeping the tree balanced. This means that the tree is always approximately balanced, which allows for fast insertion, deletion, and lookup of data.
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://en.wikipedia.org/wiki/Self-balancing_binary_search_tree'>Self-balancing binary search tree - Wikipedia</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=IbNZ-x1I2IM'>Balanced Search Trees Operations and Applications 11 min</BadgeLink>
<BadgeLink colorScheme='red' badgeText='Watch' href='https://www.youtube.com/watch?v=q4fnJZr8ztY'>Balanced binary search tree rotations</BadgeLink>

Loading…
Cancel
Save