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
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,7 +156,7 @@ var list = Arrays.stream(arr).boxed().sorted().collect(Collectors.toCollection(A
156
156
157
157
-Advancing through an array, EPI#5.4: [c++](cpp-algorithm/src/array) |Advance through the array to the last index.
158
158
-Arbitrary precision operation - increment an arbitrary-precision integer, EPI#5.2: [c++](cpp-algorithm/src/array)(`PlusOne`) |Add one to the number represented by the vector.
159
-
-Arbitrary precision operation - add two arbitrary-precision integers: [c++](cpp-algorithm/src/array)((`StringAddition`)) |Add two numbers represented by strings.
159
+
-Arbitrary precision operation - add two arbitrary-precision integers: [c++](cpp-algorithm/src/array)(`StringAddition`) |Add two numbers represented by strings.
160
160
-Arbitrary precision operation - multiply two arbitrary-precision integers, EPI#5.3: [c++](cpp-algorithm/src/array)(`Multiply`) |Multiply two numbers represented by vectors.
161
161
-Delete duplicates from a sorted array, EPI#5.5: [c++](cpp-algorithm/src/array)(`DeleteDuplicates`) |Delete duplicate elements in the array.
162
162
-Delete duplicates from a sorted array: [c++](cpp-algorithm/src/array)(`DeleteDuplicateElements`) |Delete duplicate elements in the array.
@@ -260,7 +260,7 @@ algorithm DFS-VISIT(G, u):
260
260
u.finished = time
261
261
```
262
262
263
-
- Dijkstra's algorithm: [c++](cpp-algorithm/src/graph), [java](java-algorithm/src/main/java/com/example/algorithm/graph) |A single source shortest path algorithm that handle non-negative edge weights. It find the shortest path between two vertices in a graph.
263
+
- Dijkstra's algorithm: [c++](cpp-algorithm/src/graph), [java](java-algorithm/src/main/java/com/example/algorithm/graph) |A single source the shortest path algorithm that handle non-negative edge weights. It find the shortest path between two vertices in a graph.
|**Best**| $O(n)$ | when the input list is already sorted in the desired order |
997
+
|**Best**| $O(n)$ | when the input list is already sorted in the desired order (ascending or descending)|
998
998
|**Worst**| $O(n^2)$ | when the input list is already sorted in the reverse order of the desired sorting order |
999
-
|**Average**| $O(n^2)$ ||
999
+
|**Average**| $O(n^2)$ |when the input list is in jumbled order|
1000
1000
1001
1001
-Bucket sort: [java](java-algorithm/src/main/java/com/example/algorithm/sort) |Bucket sort is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket contains a range of values and the elements are sorted within these buckets using any of the suitable sorting algorithms (such as insertion sort, merge sort, selection sort).<br>(`n` is the number of elements and `k` is the number of buckets)
-Counting sort: [java](java-algorithm/src/main/java/com/example/algorithm/sort) |Counting sort is a non-comparative sorting algorithm that sorts the elements of an array by counting the occurrences of each element in the array. The count is stored in an auxiliary array and the sorting is done by mapping the count as an index of the auxiliary array. It is used as a subroutine in radix sort.<br>(`n` is the number of elements and `k` is the range of input values)
|**Best**| $O(n + k)$ | when the input elements have a small range of values |
1014
+
|**Worst**| $O(n + k)$ | when the input elements have a large range of values |
1015
+
|**Average**| $O(n + k)$ |when the elements are distributed randomly in the array|
1016
1016
1017
1017
-Heap sort: [java](java-algorithm/src/main/java/com/example/algorithm/sort) |Heap sort is a comparison-based sorting algorithm that uses a binary heap data structure to sort an array. It is used for the implementation of priority queue.<br>(`n` is the number of elements)
- Merge two sorted arrays, EPI#13.2, LeetCode#merge-sorted-array: [c++](cpp-algorithm/src/sort)(`MergeTwoSortedArray`) | Merge two sorted array. Merge the second array into the first array.
1063
1063
- Partitioning and sorting an array with many repeated entries, EPI#13.9: [java](java-algorithm/src/main/java/com/example/algorithm/sort)(`GroupByAge`) | Given an array of objects with an age field, reorder the array so that objects of equal age appear together. They should be sorted in ascending order of age, and the order of objects with the same age is not important.
1064
1064
- Remove first-name duplicates, EPI#13.4: [c++](cpp-algorithm/src/sort)(`EliminateFirstNameDuplicate`) | Given an array of names, remove the duplicates of the first name.
1065
-
- Salary threadhold, EPI#13.12: [java](java-algorithm/src/main/java/com/example/algorithm/sort)(`SalaryThreshold`) | Given an array of salaries and a budget, compute the salary cap so that the total salaries equal the budget.
1065
+
- Salary threshold, EPI#13.12: [java](java-algorithm/src/main/java/com/example/algorithm/sort)(`SalaryThreshold`) | Given an array of salaries and a budget, compute the salary cap so that the total salaries equal the budget.
1066
1066
- Team photo day, EPI#13.10: [java](java-algorithm/src/main/java/com/example/algorithm/sort)(`SortPlayerByHeight`) | Given two arrays of numbers, for team photos, players are arranged in front and back rows and then photographed. The players in the back row must necessarily be taller than those in the front row. Additionally, all players in a row should belong to the same team.
1067
1067
- Union of intervals, EPI#13.8: [c++](cpp-algorithm/src/sort)(`UnionOfIntervals`) | Given a set of intervals, compute their union.
0 commit comments