You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-49Lines changed: 49 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -154,24 +154,24 @@ var list = Arrays.stream(arr).boxed().sorted().collect(Collectors.toCollection(A
154
154
155
155
**Examples**
156
156
157
-
-Advancing through an array: [c++](cpp-algorithm/src/array) |Advance through the array to the last index.
158
-
-Arbitrary precision operation - increment an arbitrary-precision integer (`PlusOne`): [c++](cpp-algorithm/src/array) |Add one to the number represented by the vector.
157
+
-Advancing through an array, EPI#5.4: [c++](cpp-algorithm/src/array) |Advance through the array to the last index.
158
+
-Arbitrary precision operation - increment an arbitrary-precision integer (`PlusOne`), EPI#5.2: [c++](cpp-algorithm/src/array) |Add one to the number represented by the vector.
159
159
-Arbitrary precision operation - add two arbitrary-precision integers (`StringAddition`): [c++](cpp-algorithm/src/array) |Add two numbers represented by strings.
160
-
-Arbitrary precision operation - multiply two arbitrary-precision integers (`Multiply`): [c++](cpp-algorithm/src/array) |Multiply two numbers represented by vectors.
161
-
-Delete duplicates from a sorted array (`DeleteDuplicates`): [c++](cpp-algorithm/src/array) |Delete duplicate elements in the array.
160
+
-Arbitrary precision operation - multiply two arbitrary-precision integers (`Multiply`), EPI#5.3: [c++](cpp-algorithm/src/array) |Multiply two numbers represented by vectors.
161
+
-Delete duplicates from a sorted array (`DeleteDuplicates`), EPI#5.5: [c++](cpp-algorithm/src/array) |Delete duplicate elements in the array.
162
162
-Delete duplicates from a sorted array (`DeleteDuplicateElements`): [c++](cpp-algorithm/src/array) |Delete duplicate elements in the array.
163
163
-Delete specific elements from a sorted array (`DeleteSpecificElements`): [c++](cpp-algorithm/src/array) |Delete specific elements in the array.
164
-
-Dutch national flags problem: [c++](cpp-algorithm/src/array)
165
-
-Enumerate prime numbers: [c++](cpp-algorithm/src/array) |Enumerate prime numbers in the range.
164
+
-Dutch national flags problem, EPI#5.1: [c++](cpp-algorithm/src/array)
165
+
-Enumerate prime numbers, EPI#5.9: [c++](cpp-algorithm/src/array) |Enumerate prime numbers in the range.
166
166
-Order elements in an array by even and odd (`EvenOdd`): [c++](cpp-algorithm/src/array) |Order even and odd numbers in the array.
167
-
-Order elements in an array by specified order (`Rearrange`): [c++](cpp-algorithm/src/array) |Rearrange arrays to have a specific order.
168
-
-Random data sampling - offline (`OfflineRandomSampling`): [c++](cpp-algorithm/src/array) |Randomly select k elements from the array.
169
-
-Random data sampling - compute permutation (`ComputeRandomPermutation`): [c++](cpp-algorithm/src/array) |Compute permutation of the array generated by random sampling.
167
+
-Order elements in an array by specified order (`Rearrange`), EPI#5.8: [c++](cpp-algorithm/src/array) |Rearrange arrays to have a specific order.
168
+
-Random data sampling - offline (`OfflineRandomSampling`), EPI#5.12: [c++](cpp-algorithm/src/array) |Randomly select k elements from the array.
169
+
-Random data sampling - compute permutation (`ComputeRandomPermutation`), EPI#5.14: [c++](cpp-algorithm/src/array) |Compute permutation of the array generated by random sampling.
170
170
-Replace elements - replace and remove (`ReplaceAndRemoveString1`): [c++](cpp-algorithm/src/array) |Replace element and remove element in the array. Keep the array size.
171
171
-Replace elements - replace and remove (`ReplaceAndRemoveString2`): [c++](cpp-algorithm/src/array) |Replace element and remove element in the array
172
172
-Replace elements - telex encoding (`TelexEncoding`): [c++](cpp-algorithm/src/array) |Telex encoding for punctuation marks.
173
-
-Stock trading - buy and sell a stock once (`BuyAndSellStockOnceBruteForce`, `BuyAndSellStockOnce`): [c++](cpp-algorithm/src/array)
174
-
-Stock trading - buy and sell a stock twice (`BuyAndSellStockTwice`): [c++](cpp-algorithm/src/array)
173
+
-Stock trading - buy and sell a stock once (`BuyAndSellStockOnceBruteForce`, `BuyAndSellStockOnce`), EPI#5.6: [c++](cpp-algorithm/src/array)
174
+
-Stock trading - buy and sell a stock twice (`BuyAndSellStockTwice`), EPI#5.7: [c++](cpp-algorithm/src/array)
175
175
176
176
[:arrow_up_small: back to toc](#table-of-contents)
177
177
@@ -518,19 +518,19 @@ iterator(), listIterator()
518
518
519
519
**Examples**
520
520
521
-
-Add list-based integers (`AddTwoNumbers`): [c++](cpp-algorithm/src/linked_list) |Add two numbers represented by linked list.
522
-
-Delete a node from linked list (`DeleteNodeFromList`): [c++](cpp-algorithm/src/linked_list) |Delete a node from a linked list.
523
-
-Delete duplicate nodes from sorted linked list (`DeleteDuplicateNode`): [c++](cpp-algorithm/src/linked_list) |Delete duplicate nodes from a sorted linked list.
524
-
-Delete the k-th last node from linked list (`DeleteNodeKthLast`): [c++](cpp-algorithm/src/linked_list) |Delete the $k$-th last node from a linked list.
525
-
-Implement cyclic right shift for a singly linked list (`CyclicallyRightShiftList`): [c++](cpp-algorithm/src/linked_list) |Implement cyclic right shift for a singly linked list.
526
-
-Linked list has a cycle (`HasCycle1`, `HasCycle2`, `HasCycle3`): [c++](cpp-algorithm/src/linked_list) |Determine that a linked list has a cycle.
527
-
-List pivoting (`ListPivoting`): [c++](cpp-algorithm/src/linked_list) |Rearrange nodes smaller than pivot to the left and larger than pivot to the right.
528
-
-Merge even and odd nodes in linked list (`MergeEvenOddLinkedList`): [c++](cpp-algorithm/src/linked_list) |Merge even and odd nodes in a singly linked list.
529
-
-Merge two sorted linked lists: [c++](cpp-algorithm/src/linked_list) |Merge two sorted linked lists. In worst-case, this task has $O(n + m)$ time complexity, where $n$ and $m$ are the length of the lists.
530
-
-Palindrome list (`IsListPalindrome`): [c++](cpp-algorithm/src/linked_list) |Determine that a linked list is a palindrome.
531
-
-Reverse a single sublist: [c++](cpp-algorithm/src/linked_list) |Reverse a single sublist of a linked list.
532
-
-Two linked lists overlap (`OverlappingNoCycleList`): [c++](cpp-algorithm/src/linked_list) |Determine that two linked lists without cycle overlap.
533
-
-Two linked lists with cycles overlap (`OverlappingCycleList`) [c++](cpp-algorithm/src/linked_list) |Determine that two linked lists with cycle overlap.
521
+
-Add list-based integers (`AddTwoNumbers`), EPI#7.13: [c++](cpp-algorithm/src/linked_list) |Add two numbers represented by linked list.
522
+
-Delete a node from linked list (`DeleteNodeFromList`), EPI#7.6: [c++](cpp-algorithm/src/linked_list) |Delete a node from a linked list.
523
+
-Delete duplicate nodes from sorted linked list (`DeleteDuplicateNode`), EPI#7.8: [c++](cpp-algorithm/src/linked_list) |Delete duplicate nodes from a sorted linked list.
524
+
-Delete the k-th last node from linked list (`DeleteNodeKthLast`), EPI#7.7: [c++](cpp-algorithm/src/linked_list) |Delete the $k$-th last node from a linked list.
525
+
-Implement cyclic right shift for a singly linked list (`CyclicallyRightShiftList`), EPI#7.9: [c++](cpp-algorithm/src/linked_list) |Implement cyclic right shift for a singly linked list.
526
+
-Linked list has a cycle (`HasCycle1`, `HasCycle2`, `HasCycle3`), EPI#7.3: [c++](cpp-algorithm/src/linked_list) |Determine that a linked list has a cycle.
527
+
-List pivoting (`ListPivoting`), EPI#7.12: [c++](cpp-algorithm/src/linked_list) |Rearrange nodes smaller than pivot to the left and larger than pivot to the right.
528
+
-Merge even and odd nodes in linked list (`MergeEvenOddLinkedList`), EPI#7.10: [c++](cpp-algorithm/src/linked_list) |Merge even and odd nodes in a singly linked list.
529
+
-Merge two sorted linked lists (`MergeTwoSortedLinkedList`), EPI#7.1: [c++](cpp-algorithm/src/linked_list) |Merge two sorted linked lists. In worst-case, this task has $O(n + m)$ time complexity, where $n$ and $m$ are the length of the lists.
530
+
-Palindrome list (`IsListPalindrome`), EPI#7.11: [c++](cpp-algorithm/src/linked_list) |Determine that a linked list is a palindrome.
531
+
-Reverse a single sublist (`ReverseSubList`), EPI#7.2: [c++](cpp-algorithm/src/linked_list) |Reverse a single sublist of a linked list.
532
+
-Two linked lists overlap (`OverlappingNoCycleList`), EPI#7.4: [c++](cpp-algorithm/src/linked_list) |Determine that two linked lists without cycle overlap.
533
+
-Two linked lists with cycles overlap (`OverlappingCycleList`), EPI#7.5 [c++](cpp-algorithm/src/linked_list) |Determine that two linked lists with cycle overlap.
534
534
535
535
[:arrow_up_small: back to toc](#table-of-contents)
-Least common multiple (LCM): [python](python-algorithm/algorithm/math), [java](java-algorithm/src/main/java/com/example/algorithm/math) |Find the least common multiple of two numbers.
766
766
-Miller-Rabin primality test: [c++](cpp-algorithm/src/math) |Miller-Rabin primality test is a mathematical algorithm that finds whether a given number is prime.
767
767
-Permutation (`Permutation`): [c++](cpp-algorithm/src/math) |Find the permutation of a set of items.
768
-
-Permutation (`ApplyPermutationWithAdditionalSpace`, `ApplyPermutationBySwap`): [c++](cpp-algorithm/src/math) |Permute the elements of an array
768
+
-Permutation (`ApplyPermutationWithAdditionalSpace`, `ApplyPermutationBySwap`), EPI#5.10: [c++](cpp-algorithm/src/math) |Permute the elements of an array
-Permutation (`NextPermutation`/`PreviousPermutation`): [c++](cpp-algorithm/src/math) |Compute the next/previous permutation.
771
-
-Permutation (`KthPermutation`): [c++](cpp-algorithm/src/math) |Compute the $k$-th permutation.
770
+
-Permutation (`NextPermutation`/`PreviousPermutation`), EPI#5.11: [c++](cpp-algorithm/src/math) |Compute the next/previous permutation.
771
+
-Permutation (`KthPermutation`), EPI#5.11: [c++](cpp-algorithm/src/math) |Compute the $k$-th permutation.
772
772
-Prime number (`isPrime`): [java](java-algorithm/src/main/java/com/example/algorithm/math) |Check whether a given number is prime.
773
773
-Simplex algorithm:Simplex algorithm is a mathematical algorithm that finds the optimal solution to a linear programming problem.
774
774
-System of linear equations:System of linear equations is a mathematical algorithm that finds the solution to a system of linear equations.
@@ -862,17 +862,17 @@ var randomBoolean = random.nextBoolean(); // true/false
862
862
863
863
**Examples**
864
864
865
-
-Arithmetic operation (`Multiply`/`Divide`): [c++](cpp-algorithm/src/primitive_type) |Calculate the product/fraction of two numbers without using arithmetic operators.
865
+
-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.
866
866
-Computing parity of word (`CountBits`): [c++](cpp-algorithm/src/primitive_type) |Count the number of bits that are set to 1.
867
-
-Computing parity of word (`Parity`): [c++](cpp-algorithm/src/primitive_type) |Compute parity of word.
868
-
-Computing parity of word (`ParityDropLowestBits`): [c++](cpp-algorithm/src/primitive_type) |Compute parity by dropping the lowest set bit.
869
-
-Computing parity of word (`ParityLookupTable`): [c++](cpp-algorithm/src/primitive_type) |Compute parity by caching the results.
870
-
-Generate random number: [c++](cpp-algorithm/src/primitive_type) |Generate a random number in a range with equal probability.
871
-
-Integer palindrome: [c++](cpp-algorithm/src/primitive_type) |Checkif a number is a palindrome.
-Rectangle intersection, EPI#4.11: [c++](cpp-algorithm/src/primitive_type) |Checkif two rectangles intersect.
874
+
-Reverse digits, EPI#4.8: [c++](cpp-algorithm/src/primitive_type) |Reverse the digits of a given integer.
875
+
-Swap bit, EPI#4.2: [c++](cpp-algorithm/src/primitive_type) |Swap the bits at indices $i$ and $j$.
876
876
877
877
[:arrow_up_small: back to toc](#table-of-contents)
878
878
@@ -934,8 +934,8 @@ Collections.binarySearch(arrayList, 3); // for list
934
934
-Search a sorted array for entry equal to its index (`SearchEntryEqualToItsIndex`), EPI#11.2: [c++](cpp-algorithm/src/search)
935
935
-Search a sorted array for the first greater than a key (`SearchFirstGreaterThanKey`): [c++](cpp-algorithm/src/search)
936
936
-Search a sorted array for the first occurrence of a key (`SearchFirstOfKey`), EPI#11.1: [c++](cpp-algorithm/src/search)
937
-
-Search a cyclically sorted array for the smallest element (`SearchSmallestElementInCyclicallySortedArray`), EPI11.3: [c++](cpp-algorithm/src/search)
938
-
-Search in a 2D sorted array(matrix) (`SearchSortedMatrix`), EPI11.6: [c++](cpp-algorithm/src/search) |Search in a 2D sorted array(matrix) for a given element.
937
+
-Search a cyclically sorted array for the smallest element (`SearchSmallestElementInCyclicallySortedArray`), EPI#11.3: [c++](cpp-algorithm/src/search)
938
+
-Search in a 2D sorted array(matrix) (`SearchSortedMatrix`), EPI#11.6: [c++](cpp-algorithm/src/search) |Search in a 2D sorted array(matrix) for a given element.
939
939
940
940
[:arrow_up_small: back to toc](#table-of-contents)
941
941
@@ -1116,19 +1116,19 @@ var str = collection.stream()
1116
1116
1117
1117
**Examples**
1118
1118
1119
-
- Convert string (`IntToString`, `StringToInt`): [c++](cpp-algorithm/src/string) | Convert integer to string and vice versa.
1119
+
- Convert string (`IntToString`, `StringToInt`), EPI#6.1: [c++](cpp-algorithm/src/string) | Convert integer to string and vice versa.
1120
1120
- Finite automata
1121
-
- IP address validation: [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.
1121
+
- 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
1122
- Knuth-Morris-Pratt algorithm (KMP)
1123
-
- Look and say problem: [c++](cpp-algorithm/src/string)
1123
+
- Look and say problem, EPI#6.7: [c++](cpp-algorithm/src/string)
1124
1124
- Naive string matching: [c++](cpp-algorithm/src/string), [python](python-algorithm/algorithm/string) | Find all occurrences of a pattern in a string.
1125
-
- Palindrome: [c++](cpp-algorithm/src/string) | Check if a string is palindromic.
1126
-
- Print sine wave pattern string (`SineWaveString` and `PrintSineWaveString`): [c++](cpp-algorithm/src/string) | Print a string in sine wave pattern.
1127
-
- Rabin-Karp algorithm: [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.
1128
-
- Roman number (`VerifyRomanString`): [c++](cpp-algorithm/src/string) | Verify if a string is a valid roman number.
1129
-
- Roman number (`RomanStringToInteger`): [c++](cpp-algorithm/src/string) | Convert a roman number to integer.
1130
-
- Run-length encoding (RLE): [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.
1131
-
- Spreadsheet column decoding/encoding (`DecodingSheetColumnId`/`EncodingSheetColumnId`): [c++](cpp-algorithm/src/string) | Convert a spreadsheet column id to integer and vice versa.
1125
+
- Palindrome, EPI#6.5: [c++](cpp-algorithm/src/string) | Check if a string is palindromic.
1126
+
- 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.
1128
+
- Roman number (`VerifyRomanString`), EPI#6.8: [c++](cpp-algorithm/src/string) | Verify if a string is a valid roman number.
1129
+
- Roman number (`RomanStringToInteger`), EPI#6.8: [c++](cpp-algorithm/src/string) | Convert a roman number to integer.
1130
+
- 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.
1131
+
- Spreadsheet column decoding/encoding (`DecodingSheetColumnId`/`EncodingSheetColumnId`), EPI#6.3: [c++](cpp-algorithm/src/string) | Convert a spreadsheet column id to integer and vice versa.
1132
1132
1133
1133
[:arrow_up_small: back to toc](#table-of-contents)
0 commit comments