Skip to content

Commit 8925db8

Browse files
committed
update readme
1 parent 5a11c68 commit 8925db8

File tree

2 files changed

+38
-197
lines changed

2 files changed

+38
-197
lines changed

README.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,14 @@ add(1), peek(), poll(), remove(), size(), isEmpty(),
471471
contains(1), clear(), iterator()
472472
```
473473

474+
**Heap algorithms**
475+
476+
- Fibonacci heap
477+
474478
**Examples**
475479

476480
- Compute the k closest stars (`FindClosestStar`): [c++](cpp-algorithm/src/heap) | Find the $k$ closest stars to the earth. The stars are represented by a sequence of points(coordinates).
477481
- Compute the median of a sequence of numbers (`FindMedian`): [c++](cpp-algorithm/src/heap) | Find the median of a sequence of numbers. The median is the number separating the higher half of a data sample from the lower half.
478-
- Fibonacci heap
479482
- Merge sorted arrays (`MergeSortedArray`): [c++](cpp-algorithm/src/heap) | Merge k sorted arrays into one heap.
480483
- Sort an increasing-decreasing array (`SortIncreasingDecreasingArray`): [c++](cpp-algorithm/src/heap) | Sort an array that is repeatedly increasing then decreasing.
481484

@@ -684,25 +687,28 @@ headSet(3), tailSet(3), subSet(2, 4), descendingSet()
684687
- Inorder traversal (left, root, right): best choice for applications where internal vertices must be explored in-order.
685688
- Postorder traversal (left, right, root): best choice for applications where leaves need to be explored before internal vertices.
686689

687-
**Examples**
690+
**Tree algorithms**
688691

689692
- AVL tree
690693
- B-tree: [c++](cpp-algorithm/src/tree) | B-tree is a self-balancing data structure which can have many child nodes. It is commonly used in auxiliary storage devices and database system. B-tree has the following properties: 1) Nodes have lower and upper bounds on the number of keys they can contain. (represent using degree $t$) 2) Every node other than the root must have at least $t-1$ keys. 3) Every node may contain at most $2t-1$ keys.
691-
- Balanced tree status: [c++](cpp-algorithm/src/tree) | Whether the binary tree is balanced or not.
692694
- Binary search tree: [c++](cpp-algorithm/src/tree) | In binary search tree, all internal nodes are stored in ordered state. If $y$ is a child of $x$ and $y$ is a node in the left subtree, then $y.key \leq x.key$, and if $y$ is a node in the right subtree, then $y.key \geq x.key$.
695+
- Red-black tree
696+
- Trie
697+
- van Emde Boas tree (vEB tree)
698+
699+
**Examples**
700+
701+
- Balanced tree status: [c++](cpp-algorithm/src/tree) | Whether the binary tree is balanced or not.
693702
- Binary tree exterior (`CreateExteriorNodeList`): [c++](cpp-algorithm/src/tree) | Create a vector of exterior nodes in a binary tree.
694703
- Construct binary tree from preorder and inorder traversal (`ConstructTreeFromPreorderInorder`): [c++](cpp-algorithm/src/tree) | Construct a binary search tree from preorder and inorder traversal. This task has $O(n)$ time complexity.
695704
- Construct binary tree from preorder with marker (`ConstructTreeFromMarkerPreorder`): [c++](cpp-algorithm/src/tree) | Construct a binary search tree from preorder traversal with marker. This task has $O(n)$ time complexity.
696705
- Leaf node list (`CreateLeafNodeList`): [c++](cpp-algorithm/src/tree) | Create a vector of leaf nodes in a binary tree.
697706
- Lowest common ancestor (`FindLowestCommonAncestor`): [c++](cpp-algorithm/src/tree) | Find the lowest common ancestor of two nodes in a binary tree.
698707
- Lowest common ancestor with parent pointer (`FindLowestCommonAncestor2`): [c++](cpp-algorithm/src/tree) | Find the lowest common ancestor of two nodes in a binary tree. The nodes have parent pointers.
699708
- Populate right sibling (`PopulateRightSibling`): [c++](cpp-algorithm/src/tree) | Populate the right sibling of a binary tree.
700-
- Red-black search tree
701709
- Root to leaf path corresponding to the given sum (`HasKeySum`): [c++](cpp-algorithm/src/tree) | Whether the tree has a root-leaf path equal to the given sum.
702710
- Sum of root to leaf (`SumRootToLeafDecimal`, `SumRootToLeafBinary`): [c++](cpp-algorithm/src/tree) | Sum of all root to leaf paths in a binary tree (decimal and binary representation).
703711
- Tree symmetric: [c++](cpp-algorithm/src/tree) | Whether the binary tree is symmetric or not.
704-
- Trie
705-
- van Emde Boas tree (vEB tree)
706712

707713
[:arrow_up_small: back to toc](#table-of-contents)
708714

@@ -860,16 +866,19 @@ var randomDouble = random.nextDouble(); // [0.0, 1.0)
860866
var randomBoolean = random.nextBoolean(); // true/false
861867
```
862868

863-
**Examples**
869+
**Primitive type algorithms**
864870

865871
- Arithmetic operation (`Multiply`/`Divide`), EPI#4.5, EPI#4.6: [c++](cpp-algorithm/src/primitive_type) | Calculate the product/fraction of two numbers without using arithmetic operators.
872+
- Power operation, EPI#4.7: [c++](cpp-algorithm/src/primitive_type) | Compute repeated squaring $x^y$.
873+
874+
**Examples**
875+
866876
- Computing parity of word (`CountBits`): [c++](cpp-algorithm/src/primitive_type) | Count the number of bits that are set to 1.
867877
- Computing parity of word (`Parity`), EPI#4.1: [c++](cpp-algorithm/src/primitive_type) | Compute parity of word.
868878
- Computing parity of word (`ParityDropLowestBits`), EPI#4.1: [c++](cpp-algorithm/src/primitive_type) | Compute parity by dropping the lowest set bit.
869879
- Computing parity of word (`ParityLookupTable`), EPI#4.1: [c++](cpp-algorithm/src/primitive_type) | Compute parity by caching the results.
870880
- Generate random number, EPI#4.10: [c++](cpp-algorithm/src/primitive_type) | Generate a random number in a range with equal probability.
871881
- Integer palindrome, EPI#4.9: [c++](cpp-algorithm/src/primitive_type) | Check if a number is a palindrome.
872-
- Power operation, EPI#4.7: [c++](cpp-algorithm/src/primitive_type) | Compute repeated squaring $x^y$.
873882
- Rectangle intersection, EPI#4.11: [c++](cpp-algorithm/src/primitive_type) | Check if two rectangles intersect.
874883
- Reverse digits, EPI#4.8: [c++](cpp-algorithm/src/primitive_type) | Reverse the digits of a given integer.
875884
- Swap bit, EPI#4.2: [c++](cpp-algorithm/src/primitive_type) | Swap the bits at indices $i$ and $j$.
@@ -923,14 +932,17 @@ Arrays.binarySearch(array, 3) // for array
923932
Collections.binarySearch(arrayList, 3); // for list
924933
```
925934

926-
**Examples**
935+
**Search algorithms**
927936

928937
- Binary search: [python](python-algorithm/algorithm/search) | Binary search is a search algorithm that finds the position of a target value within a sorted array.
929-
- Find k-th smallest/largest element in an array (`FindKthSmallestElement`/`FindKthLargestElement`), EPI#11.8: [c++](cpp-algorithm/src/search) | Find the k-th smallest/largest element in an array using the quickselect algorithm (`QuickSelectAlgorithm`).
930-
- Find the minimum and maximum elements in an array (`FindMinMax`), EPI#11.7: [c++](cpp-algorithm/src/search)
931938
- Integer square root (`ComputeIntegerSquareRoot`), EPI#11.4: [c++](cpp-algorithm/src/search) | Compute the integer square root of a given integer. This function returns the largest integer whose square is less than or equal to the given integer.
932939
- Linear search: [python](python-algorithm/algorithm/search) | Linear search is a search algorithm that compares x successively with each term of the list until a match is found.
933940
- Quick select algorithm (`QuickSelectAlgorithm`): [c++](cpp-algorithm/src/search) | QuickSelect is an algorithm used to select the k-th smallest (or largest) element in an unordered list of elements.
941+
942+
**Examples**
943+
944+
- Find k-th smallest/largest element in an array (`FindKthSmallestElement`/`FindKthLargestElement`), EPI#11.8: [c++](cpp-algorithm/src/search) | Find the k-th smallest/largest element in an array using the quickselect algorithm (`QuickSelectAlgorithm`).
945+
- Find the minimum and maximum elements in an array (`FindMinMax`), EPI#11.7: [c++](cpp-algorithm/src/search)
934946
- Search a sorted array for entry equal to its index (`SearchEntryEqualToItsIndex`), EPI#11.2: [c++](cpp-algorithm/src/search)
935947
- Search a sorted array for the first greater than a key (`SearchFirstGreaterThanKey`): [c++](cpp-algorithm/src/search)
936948
- Search a sorted array for the first occurrence of a key (`SearchFirstOfKey`), EPI#11.1: [c++](cpp-algorithm/src/search)
@@ -1114,17 +1126,20 @@ var str = collection.stream()
11141126
.collect(StringBuilder::new, StringBuilder::append, StringBuilder::append);
11151127
```
11161128
1129+
**String algorithms**
1130+
1131+
- Finite automata
1132+
- Knuth-Morris-Pratt algorithm (KMP)
1133+
- Naive string matching: [c++](cpp-algorithm/src/string), [python](python-algorithm/algorithm/string) | Find all occurrences of a pattern in a string.
1134+
- Rabin-Karp algorithm, EPI#6.12: [c++](cpp-algorithm/src/string) | Use the hash function to find all occurrences of a pattern in a string. It has $\theta(\text{pattern-size})$ preprocessing time and $\theta((\text{text-size} - \text{pattern-size} + 1) \text{pattern-size})$ time complexity.
1135+
11171136
**Examples**
11181137
11191138
- Convert string (`IntToString`, `StringToInt`), EPI#6.1: [c++](cpp-algorithm/src/string) | Convert integer to string and vice versa.
1120-
- Finite automata
11211139
- IP address validation, EPI#6.9: [c++](cpp-algorithm/src/string) | Validate IPv4 address that is in the form of `x.x.x.x` where `x` is a number between 0 and 255.
1122-
- Knuth-Morris-Pratt algorithm (KMP)
11231140
- Look and say problem, EPI#6.7: [c++](cpp-algorithm/src/string)
1124-
- Naive string matching: [c++](cpp-algorithm/src/string), [python](python-algorithm/algorithm/string) | Find all occurrences of a pattern in a string.
11251141
- Palindrome, EPI#6.5: [c++](cpp-algorithm/src/string) | Check if a string is palindromic.
11261142
- Print sine wave pattern string (`SineWaveString` and `PrintSineWaveString`), EPI#6.10: [c++](cpp-algorithm/src/string) | Print a string in sine wave pattern.
1127-
- Rabin-Karp algorithm, EPI#6.12: [c++](cpp-algorithm/src/string) | Use the hash function to find all occurrences of a pattern in a string. It has $\theta(\text{pattern-size})$ preprocessing time and $\theta((\text{text-size} - \text{pattern-size} + 1) \text{pattern-size})$ time complexity.
11281143
- Roman number (`VerifyRomanString`), EPI#6.8: [c++](cpp-algorithm/src/string) | Verify if a string is a valid roman number.
11291144
- Roman number (`RomanStringToInteger`), EPI#6.8: [c++](cpp-algorithm/src/string) | Convert a roman number to integer.
11301145
- Run-length encoding (RLE), EPI#6.11: [c++](cpp-algorithm/src/string) | Run-length encoding is a simple form of data compression in which runs of data are stored as a single data value and count.

0 commit comments

Comments
 (0)