From 80f708a1714e84e2ecc176464a694a8bca9ece47 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sun, 27 Sep 2020 20:57:03 +0000 Subject: [PATCH] Documentation for 67be3a592df0eeb8964ea5e2382a12a42c9df9f4 --- d3/d40/graph__coloring_8cpp.html | 6 +- d5/d4c/group__sorting.html | 80 +++++++++++-------------- d5/d88/md__d_i_r_e_c_t_o_r_y.html | 1 + de/d7b/merge__insertion__sort_8cpp.html | 2 +- 4 files changed, 39 insertions(+), 50 deletions(-) diff --git a/d3/d40/graph__coloring_8cpp.html b/d3/d40/graph__coloring_8cpp.html index bc5e41632..bbc1e7f8f 100644 --- a/d3/d40/graph__coloring_8cpp.html +++ b/d3/d40/graph__coloring_8cpp.html @@ -296,7 +296,7 @@ Functions
query
Definition: mo.cpp:6
search
Search algorithms.
main
int main()
Definition: text_search.cpp:15
-
show
void show(int *arr, int size)
Definition: merge_sort.cpp:96
+
show
void show(int *arr, int size)
Definition: merge_sort.cpp:84
test_set
const std::vector< std::vector< std::string > > test_set
Definition: brute_force_string_searching.cpp:41
rec_ternary_search
int rec_ternary_search(int left, int right, int A[], int target)
Definition: ternary_search.cpp:90
Node
Definition: linkedlist_implentation_usingarray.cpp:14
@@ -318,7 +318,7 @@ Functions
std::array::at
T at(T... args)
range_queries::heavy_light_decomposition::HLD::h_heavychlid
std::vector< int > h_heavychlid
stores the heavy child of a node
Definition: heavy_light_decomposition.cpp:340
FenwickTree::FenwickTree
FenwickTree(const std::vector< int > &arr)
Definition: fenwick_tree.cpp:28
-
mergeSort
void mergeSort(int *arr, int l, int r)
Definition: merge_sort.cpp:83
+
mergeSort
void mergeSort(int *arr, int l, int r)
Definition: merge_sort.cpp:71
main
int main()
Definition: matrix_exponentiation.cpp:126
range_queries::heavy_light_decomposition::Tree::t_adj
std::vector< std::list< int > > t_adj
an adjacency list to stores the tree edges
Definition: heavy_light_decomposition.cpp:83
std::cout
@@ -481,7 +481,7 @@ Functions
push
void push(char ch)
push byte to stack variable
Definition: paranthesis_matching.cpp:26
main
int main()
Definition: bogo_sort.cpp:104
test_2
static void test_2()
Definition: pigeonhole_sort.cpp:88
-
main
int main()
Definition: merge_sort.cpp:102
+
main
int main()
Definition: merge_sort.cpp:90
pop
char pop()
pop a byte out of stack variable
Definition: paranthesis_matching.cpp:29
InterpolationSearch
int InterpolationSearch(int A[], int n, int x)
Definition: interpolation_search2.cpp:15
horspool
Functions for Horspool's algorithm.
diff --git a/d5/d4c/group__sorting.html b/d5/d4c/group__sorting.html index f6bb8af6d..4563a8c3d 100644 --- a/d5/d4c/group__sorting.html +++ b/d5/d4c/group__sorting.html @@ -195,21 +195,21 @@ template<typename T >

Main function

-
102  {
-
103  int size;
-
104  std::cout << "Enter the number of elements : ";
-
105  std::cin >> size;
-
106  int *arr = new int[size];
-
107  std::cout << "Enter the unsorted elements : ";
-
108  for (int i = 0; i < size; ++i) {
-
109  std::cin >> arr[i];
-
110  }
-
111  mergeSort(arr, 0, size - 1);
-
112  std::cout << "Sorted array : ";
-
113  show(arr, size);
-
114  delete[] arr;
-
115  return 0;
-
116 }
+
90  {
+
91  int size;
+
92  std::cout << "Enter the number of elements : ";
+
93  std::cin >> size;
+
94  int *arr = new int[size];
+
95  std::cout << "Enter the unsorted elements : ";
+
96  for (int i = 0; i < size; ++i) {
+
97  std::cin >> arr[i];
+
98  }
+
99  mergeSort(arr, 0, size - 1);
+
100  std::cout << "Sorted array : ";
+
101  show(arr, size);
+
102  delete[] arr;
+
103  return 0;
+
104 }
@@ -279,8 +279,8 @@ template<typename T >
43  i = 0;
44  j = 0;
45  k = l;
-
46  while (i < n1 && j < n2) {
-
47  if (L[i] <= R[j]) {
+
46  while (i < n1 || j < n2) {
+
47  if (j >= n2 || (i < n1 && L[i] <= R[j])) {
48  arr[k] = L[i];
49  i++;
50  } else {
@@ -290,21 +290,9 @@ template<typename T >
54  k++;
55  }
56 
-
57  while (i < n1) {
-
58  arr[k] = L[i];
-
59  i++;
-
60  k++;
-
61  }
-
62 
-
63  while (j < n2) {
-
64  arr[k] = R[j];
-
65  j++;
-
66  k++;
-
67  }
-
68 
-
69  delete[] L;
-
70  delete[] R;
-
71 }
+
57  delete[] L;
+
58  delete[] R;
+
59 }
@@ -348,14 +336,14 @@ template<typename T > -
83  {
-
84  if (l < r) {
-
85  int m = l + (r - l) / 2;
-
86  mergeSort(arr, l, m);
-
87  mergeSort(arr, m + 1, r);
-
88  merge(arr, l, m, r);
-
89  }
-
90 }
+
71  {
+
72  if (l < r) {
+
73  int m = l + (r - l) / 2;
+
74  mergeSort(arr, l, m);
+
75  mergeSort(arr, m + 1, r);
+
76  merge(arr, l, m, r);
+
77  }
+
78 }
Here is the call graph for this function:
@@ -391,17 +379,17 @@ Here is the call graph for this function:

Utility function used to print the array after sorting

-
96  {
-
97  for (int i = 0; i < size; i++) std::cout << arr[i] << " ";
-
98  std::cout << "\n";
-
99 }
+
84  {
+
85  for (int i = 0; i < size; i++) std::cout << arr[i] << " ";
+
86  std::cout << "\n";
+
87 }
-
show
void show(int *arr, int size)
Definition: merge_sort.cpp:96
-
mergeSort
void mergeSort(int *arr, int l, int r)
Definition: merge_sort.cpp:83
+
show
void show(int *arr, int size)
Definition: merge_sort.cpp:84
+
mergeSort
void mergeSort(int *arr, int l, int r)
Definition: merge_sort.cpp:71
std::cout
merge
void merge(int *arr, int l, int m, int r)
Definition: merge_sort.cpp:33
std::swap
T swap(T... args)
diff --git a/d5/d88/md__d_i_r_e_c_t_o_r_y.html b/d5/d88/md__d_i_r_e_c_t_o_r_y.html index 150d01d73..28d1cc1a7 100644 --- a/d5/d88/md__d_i_r_e_c_t_o_r_y.html +++ b/d5/d88/md__d_i_r_e_c_t_o_r_y.html @@ -164,6 +164,7 @@ Dynamic Programming
  • Fibonacci Bottom Up
  • Floyd Warshall
  • Kadane
  • +
  • Kadane2
  • Longest Common String
  • Longest Common Subsequence
  • Longest Increasing Subsequence
  • diff --git a/de/d7b/merge__insertion__sort_8cpp.html b/de/d7b/merge__insertion__sort_8cpp.html index 91f4ead63..a0cc089c4 100644 --- a/de/d7b/merge__insertion__sort_8cpp.html +++ b/de/d7b/merge__insertion__sort_8cpp.html @@ -503,7 +503,7 @@ Here is the call graph for this function:
    std::srand
    T srand(T... args)
    std::is_sorted
    T is_sorted(T... args)
    -
    mergeSort
    void mergeSort(int *arr, int l, int r)
    Definition: merge_sort.cpp:83
    +
    mergeSort
    void mergeSort(int *arr, int l, int r)
    Definition: merge_sort.cpp:71
    std::cout
    merge
    void merge(int *arr, int l, int m, int r)
    Definition: merge_sort.cpp:33
    std::array
    STL class.