From b33b81e8536eb8d5e2ac55fbd9ba978b7002556f Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Mon, 25 Oct 2021 16:16:09 +0000 Subject: [PATCH] Documentation for 4d884b0dc7514b1389056f53be18dacb8c452b33 --- d8/d9c/union__of__two__arrays_8cpp.html | 29 +++---- ...mespaceoperations__on__datastructures.html | 80 +++++++++---------- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/d8/d9c/union__of__two__arrays_8cpp.html b/d8/d9c/union__of__two__arrays_8cpp.html index 9043dbcbc..eac9e0e9b 100644 --- a/d8/d9c/union__of__two__arrays_8cpp.html +++ b/d8/d9c/union__of__two__arrays_8cpp.html @@ -154,7 +154,8 @@ Functions

Detailed Description

Implementation for the Union of two sorted Arrays algorithm.

-

The Union of two arrays is the collection of all the unique elements in the first array, combined with all of the unique elements of a second array. This implementation uses ordered arrays, and an algorithm to correctly order them and return the result as a new array (vector).

Author
Alvin
+

The Union of two arrays is the collection of all the unique elements in the first array, combined with all of the unique elements of a second array. This implementation uses ordered arrays, and an algorithm to correctly order them and return the result as a new array (vector).

See also
intersection_of_two_arrays.cpp
+
Author
Alvin

Function Documentation

◆ main()

@@ -174,11 +175,11 @@ Functions

main function

Returns
0 on exit
-
216 {
-
217 test(); // run self-test implementations
-
218 return 0;
-
219}
-
static void test()
Function to test the correctness of get_union() function.
Definition: union_of_two_arrays.cpp:203
+
217 {
+
218 test(); // run self-test implementations
+
219 return 0;
+
220}
+
static void test()
Function to test the correctness of get_union() function.
Definition: union_of_two_arrays.cpp:204
Here is the call graph for this function:
@@ -213,14 +214,14 @@ Here is the call graph for this function:

Function to test the correctness of get_union() function.

Returns
void
-
203 {
-
204 tests::test1();
-
205 tests::test2();
-
206 tests::test3();
-
207 tests::test4();
-
208 tests::test5();
-
209 tests::test6();
-
210}
+
204 {
+
205 tests::test1();
+
206 tests::test2();
+
207 tests::test3();
+
208 tests::test4();
+
209 tests::test5();
+
210 tests::test6();
+
211}
void test1()
A Test to check an simple case.
Definition: array_right_rotation.cpp:76
void test4()
A Test to check a very large input.
Definition: array_right_rotation.cpp:121
void test3()
A Test to check an invalid shift value.
Definition: array_right_rotation.cpp:106
diff --git a/da/d6d/namespaceoperations__on__datastructures.html b/da/d6d/namespaceoperations__on__datastructures.html index 7366af174..6e3d2bfe0 100644 --- a/da/d6d/namespaceoperations__on__datastructures.html +++ b/da/d6d/namespaceoperations__on__datastructures.html @@ -263,46 +263,46 @@ Here is the call graph for this function:

< Add the element if it is unique

< Add remaining elements

< Add the element if it is unique

-
49 {
-
50 std::vector<int32_t> res; ///< Vector to hold the union
-
51 size_t f_index = 0; ///< Index for the first array
-
52 size_t s_index = 0; ///< Index for the second array
-
53 size_t f_length = first.size(); ///< Length of first array
-
54 size_t s_length = second.size(); ///< Length of second array
-
55 int32_t next = 0; ///< Integer to store value of the next element
-
56
-
57 while (f_index < f_length && s_index < s_length) {
-
58 if (first[f_index] < second[s_index]) {
-
59 next = first[f_index]; ///< Append from first array
-
60 f_index++; ///< Increment index of second array
-
61 } else if (first[f_index] > second[s_index]) {
-
62 next = second[s_index]; ///< Append from second array
-
63 s_index++; ///< Increment index of second array
-
64 } else {
-
65 next = first[f_index]; ///< Element is the same in both
-
66 f_index++; ///< Increment index of first array
-
67 s_index++; ///< Increment index of second array too
-
68 }
-
69 if ((res.size() == 0) || (next != res.back())) {
-
70 res.push_back(next); ///< Add the element if it is unique
-
71 }
-
72 }
-
73 while (f_index < f_length) {
-
74 next = first[f_index]; ///< Add remaining elements
-
75 if ((res.size() == 0) || (next != res.back())) {
-
76 res.push_back(next); ///< Add the element if it is unique
-
77 }
-
78 f_index++;
-
79 }
-
80 while (s_index < s_length) {
-
81 next = second[s_index]; ///< Add remaining elements
-
82 if ((res.size() == 0) || (next != res.back())) {
-
83 res.push_back(next); ///< Add the element if it is unique
-
84 }
-
85 s_index++;
-
86 }
-
87 return res;
-
88}
+
50 {
+
51 std::vector<int32_t> res; ///< Vector to hold the union
+
52 size_t f_index = 0; ///< Index for the first array
+
53 size_t s_index = 0; ///< Index for the second array
+
54 size_t f_length = first.size(); ///< Length of first array
+
55 size_t s_length = second.size(); ///< Length of second array
+
56 int32_t next = 0; ///< Integer to store value of the next element
+
57
+
58 while (f_index < f_length && s_index < s_length) {
+
59 if (first[f_index] < second[s_index]) {
+
60 next = first[f_index]; ///< Append from first array
+
61 f_index++; ///< Increment index of second array
+
62 } else if (first[f_index] > second[s_index]) {
+
63 next = second[s_index]; ///< Append from second array
+
64 s_index++; ///< Increment index of second array
+
65 } else {
+
66 next = first[f_index]; ///< Element is the same in both
+
67 f_index++; ///< Increment index of first array
+
68 s_index++; ///< Increment index of second array too
+
69 }
+
70 if ((res.size() == 0) || (next != res.back())) {
+
71 res.push_back(next); ///< Add the element if it is unique
+
72 }
+
73 }
+
74 while (f_index < f_length) {
+
75 next = first[f_index]; ///< Add remaining elements
+
76 if ((res.size() == 0) || (next != res.back())) {
+
77 res.push_back(next); ///< Add the element if it is unique
+
78 }
+
79 f_index++;
+
80 }
+
81 while (s_index < s_length) {
+
82 next = second[s_index]; ///< Add remaining elements
+
83 if ((res.size() == 0) || (next != res.back())) {
+
84 res.push_back(next); ///< Add the element if it is unique
+
85 }
+
86 s_index++;
+
87 }
+
88 return res;
+
89}
T next(T... args)
Here is the call graph for this function: