-
-
108 std::cout <<
"Initialized arr = {1, 2, 3, 4, 5}\n" ;
-
-
-
-
-
113 assert(res == expected);
-
-
-
+
+
+
107 std::cout <<
"Initialized arr = {1, 2, 3, 4, 5}\n" ;
+
+
+
+
+
112 assert(res == expected);
+
+
+
@@ -307,34 +315,36 @@ Here is the call graph for this function:
A Test to check a very large input.
A Test to check correct functionality with duplicate values.
Returns void
+
< Should print {4, 6, ..., 420, 2}
< Should print {420, 2, 4, ..., 418}
< Check if result is correct
< Should print 4 6
< Check if result is correct
< Should print 2 3 4 6 7
+
< Should print {420, 2, 4, ..., 418}
< Check if result is correct
< Should print 4 6
< Check if result is correct
< Should print 2 3 4 6 7
-
-
-
123 std::cout <<
"Initialized arr = {2, 4, ..., 420}\n" ;
-
124 std::cout <<
"Expected result: {420, 2, 4, ..., 418}\n" ;
-
-
126 for (
int i = 1; i <= 210; i++) {
-
-
-
-
-
-
-
133 for (
int i = 0; i < 209; i++) {
-
-
-
136 assert(res == expected);
-
-
-
+
+
+
122 std::cout <<
"Initialized arr = {2, 4, ..., 420}\n" ;
+
123 std::cout <<
"Expected result: {4, 6, ..., 420, 2}\n" ;
+
+
125 for (
int i = 1; i <= 210; i++) {
+
+
+
+
+
+
131 for (
int i = 1; i < 210; i++) {
+
+
+
+
135 assert(res == expected);
+
+
+
@@ -364,24 +374,26 @@ Here is the call graph for this function:
A Test to check correct functionality with a harder test case.
Returns void
< Should print 1 2 3 4 5
+
< Should print 1 2 3 4 5
< Check if result is correct
< Should print 2 3 4
< Check if result is correct
< Should print 1 2 3 4 5 6 7 9
+
< Should print 1 2 3 4 5
< Check if result is correct
< Should print 2 3 4
< Check if result is correct
< Should print 1 2 3 4 5 6 7 9
-
-
-
146 std::cout <<
"Initialized arr = {1, 2, 3, 4, 5}\n" ;
-
147 std::cout <<
"Expected result: {1, 2, 3, 4, 5}\n" ;
-
-
-
-
-
-
+
+
+
145 std::cout <<
"Initialized arr = {1, 2, 3, 4, 5}\n" ;
+
146 std::cout <<
"Expected result: {1, 2, 3, 4, 5}\n" ;
+
+
+
+
+
+
diff --git a/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.map b/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.map
index 5ad3fd635..d41bced76 100644
--- a/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.map
+++ b/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.map
@@ -1,7 +1,7 @@
-
+
diff --git a/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.md5 b/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.md5
index 551b4e285..31d2a4364 100644
--- a/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.md5
+++ b/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.md5
@@ -1 +1 @@
-2b6d23453c90e7df113f7e32da7eb056
\ No newline at end of file
+7278fffe0279bc0527817ea991d25b8b
\ No newline at end of file
diff --git a/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.svg b/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.svg
index 974d824d4..a016777d5 100644
--- a/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.svg
+++ b/d9/df4/namespacetests_a167c24bd817469ae47358d12e034f2d5_cgraph.svg
@@ -36,10 +36,10 @@
Node5
-
+
operations_on_datastructures
-::shift_right
+::shift_left
diff --git a/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.map b/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.map
index 661a1354e..6a3585281 100644
--- a/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.map
+++ b/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.map
@@ -2,7 +2,7 @@
-
+
diff --git a/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.md5 b/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.md5
index 96fbac69e..b178f3843 100644
--- a/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.md5
+++ b/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.md5
@@ -1 +1 @@
-ae896779a74956320c8a9b318d12dcb4
\ No newline at end of file
+4dafaade4b3c0199732d43bde0d35173
\ No newline at end of file
diff --git a/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.svg b/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.svg
index 3c6a510b5..321bbd648 100644
--- a/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.svg
+++ b/d9/df4/namespacetests_a2b9769e44683dcb67fe1083ad91e134d_cgraph.svg
@@ -51,10 +51,10 @@
Node6
-
+
operations_on_datastructures
-::shift_right
+::shift_left
diff --git a/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.map b/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.map
index e53781fd4..f517145a9 100644
--- a/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.map
+++ b/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.map
@@ -1,7 +1,7 @@
-
+
diff --git a/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.md5 b/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.md5
index 28844817e..7920d7ee2 100644
--- a/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.md5
+++ b/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.md5
@@ -1 +1 @@
-1cf6f60cc62143f3f10be0d7bac0bd87
\ No newline at end of file
+be8e028adecb8a2346896c1b0352a1c2
\ No newline at end of file
diff --git a/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.svg b/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.svg
index d023d2706..2abf1746b 100644
--- a/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.svg
+++ b/d9/df4/namespacetests_aa515639572647508b94986489aab6d76_cgraph.svg
@@ -36,10 +36,10 @@
Node5
-
+
operations_on_datastructures
-::shift_right
+::shift_left
diff --git a/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.map b/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.map
index aa3acfa5a..45386fef8 100644
--- a/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.map
+++ b/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.map
@@ -1,7 +1,7 @@
-
+
diff --git a/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.md5 b/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.md5
index 7fab06f00..573f9ad87 100644
--- a/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.md5
+++ b/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.md5
@@ -1 +1 @@
-45a5001ed729dbb484fc88562ff5fdf0
\ No newline at end of file
+b99ae4460101260131c302ee5caba547
\ No newline at end of file
diff --git a/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.svg b/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.svg
index 3a68db17f..75d69d8a3 100644
--- a/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.svg
+++ b/d9/df4/namespacetests_abdd77344d4af8fd56d14a5cabbf2f669_cgraph.svg
@@ -36,10 +36,10 @@
Node5
-
+
operations_on_datastructures
-::shift_right
+::shift_left
diff --git a/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.map b/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.map
index ea0bace75..775491d99 100644
--- a/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.map
+++ b/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.map
@@ -1,7 +1,7 @@
-
+
diff --git a/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.md5 b/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.md5
index 6bc1e73ac..c24e6aa48 100644
--- a/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.md5
+++ b/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.md5
@@ -1 +1 @@
-311b663244f28abe66316c5c3da212f4
\ No newline at end of file
+7130eaf40b3d5935f227b3a451bf87f5
\ No newline at end of file
diff --git a/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.svg b/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.svg
index 6cb898964..2bb500e61 100644
--- a/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.svg
+++ b/d9/df4/namespacetests_af7b81d7a1534216af6a36a80135beb86_cgraph.svg
@@ -36,10 +36,10 @@
Node5
-
+
operations_on_datastructures
-::shift_right
+::shift_left
diff --git a/da/d6d/namespaceoperations__on__datastructures.html b/da/d6d/namespaceoperations__on__datastructures.html
index 6e3d2bfe0..7e61af2cc 100644
--- a/da/d6d/namespaceoperations__on__datastructures.html
+++ b/da/d6d/namespaceoperations__on__datastructures.html
@@ -104,6 +104,9 @@ Functions
void print (const std::vector < int32_t > &array)
Prints the values of a vector sequentially, ending with a newline character. More...
+std::vector < int32_t > shift_left (const std::vector < int32_t > &array, size_t shift)
+ Shifts the given vector to the left by the shift amount and returns a new vector with the result. The original vector is not mutated. More...
+
std::vector < int32_t > shift_right (const std::vector < int32_t > &array, size_t shift)
Shifts the given vector to the right by the shift amount and returns a new vector with the result. The original vector is not mutated. More...
@@ -347,14 +350,80 @@ Here is the call graph for this function:
Print newline
Print each value in the array
Print newline
-
-
31 for (int32_t i : array) {
-
-
-
-
+
Print each value in the array
+
Print newline
+
Print each value in the array
+
Print newline
+
+
30 for (int32_t i : array) {
+
+
+
+
+
+
+
+
◆ shift_left()
+
+
+
+
+
+ std::vector < int32_t > operations_on_datastructures::shift_left
+ (
+ const std::vector < int32_t > &
+ array ,
+
+
+
+
+ size_t
+ shift
+
+
+
+ )
+
+
+
+
+
+
Shifts the given vector to the left by the shift amount and returns a new vector with the result. The original vector is not mutated.
+
Shifts the values of the vector, by creating a new vector and adding values from the shift index to the end, then appending the rest of the elements from the start of the vector.
Parameters
+
+ array A reference to the input std::vector
+ shift The amount to be shifted to the left
+
+
+
+
Returns A std::vector with the shifted values
+
< We got an invalid shift, return empty array
+
< Result array
+
< Add values after the shift index
+
< Add the values from the start
+
+
48 if (array.
size () <= shift) {
+
+
+
+
52 for (
size_t i = shift; i < array.
size (); i++) {
+
53 res[i - shift] = array[i];
+
+
55 for (
size_t i = 0; i < shift; i++) {
+
56 res[array.
size () - shift + i] =
+
+
+
+
+
+
+
diff --git a/da/d6d/namespaceoperations__on__datastructures.js b/da/d6d/namespaceoperations__on__datastructures.js
index 348fd89d5..64813294f 100644
--- a/da/d6d/namespaceoperations__on__datastructures.js
+++ b/da/d6d/namespaceoperations__on__datastructures.js
@@ -21,5 +21,6 @@ var namespaceoperations__on__datastructures =
[ "get_intersection", "da/d6d/namespaceoperations__on__datastructures.html#adaf9a06f0c236c2d95c97e441ea2d12e", null ],
[ "get_union", "da/d6d/namespaceoperations__on__datastructures.html#a2b8ff06a84b041457873840bf82e2d74", null ],
[ "print", "da/d6d/namespaceoperations__on__datastructures.html#a6109193567a5b7e36a27f2b4865fce20", null ],
+ [ "shift_left", "da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8", null ],
[ "shift_right", "da/d6d/namespaceoperations__on__datastructures.html#a1bfb8711f49e591eb168ccaa3df6fb86", null ]
];
\ No newline at end of file
diff --git a/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.map b/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.map
new file mode 100644
index 000000000..bddb0b2b0
--- /dev/null
+++ b/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.map
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.md5 b/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.md5
new file mode 100644
index 000000000..915f6e6f8
--- /dev/null
+++ b/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.md5
@@ -0,0 +1 @@
+620af06cdd5679a92bf5c83c1e58a9d0
\ No newline at end of file
diff --git a/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.svg b/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.svg
new file mode 100644
index 000000000..3b711da3a
--- /dev/null
+++ b/da/d6d/namespaceoperations__on__datastructures_afce39cf843989a39811a49ebe29dd6d8_cgraph.svg
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+operations_on_datastructures::shift_left
+
+
+
+Node1
+
+
+operations_on_datastructures
+::shift_left
+
+
+
+
+
+Node2
+
+
+std::vector::size
+
+
+
+
+
+Node1->Node2
+
+
+
+
+
diff --git a/dd/d2b/array__left__rotation_8cpp__incl.map b/dd/d2b/array__left__rotation_8cpp__incl.map
new file mode 100644
index 000000000..c86c3aa42
--- /dev/null
+++ b/dd/d2b/array__left__rotation_8cpp__incl.map
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/dd/d2b/array__left__rotation_8cpp__incl.md5 b/dd/d2b/array__left__rotation_8cpp__incl.md5
new file mode 100644
index 000000000..bb9c18fac
--- /dev/null
+++ b/dd/d2b/array__left__rotation_8cpp__incl.md5
@@ -0,0 +1 @@
+6eb48da9580da83174b14728ac367b1f
\ No newline at end of file
diff --git a/dd/d2b/array__left__rotation_8cpp__incl.svg b/dd/d2b/array__left__rotation_8cpp__incl.svg
new file mode 100644
index 000000000..3f1c11c42
--- /dev/null
+++ b/dd/d2b/array__left__rotation_8cpp__incl.svg
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+operations_on_datastructures/array_left_rotation.cpp
+
+
+
+Node1
+
+
+operations_on_datastructures
+/array_left_rotation.cpp
+
+
+
+
+
+Node2
+
+
+cassert
+
+
+
+
+
+Node1->Node2
+
+
+
+
+
+Node3
+
+
+iostream
+
+
+
+
+
+Node1->Node3
+
+
+
+
+
+Node4
+
+
+vector
+
+
+
+
+
+Node1->Node4
+
+
+
+
+
diff --git a/de/dc5/intersection__of__two__arrays_8cpp.html b/de/dc5/intersection__of__two__arrays_8cpp.html
index 3f8b59c37..cb08d4813 100644
--- a/de/dc5/intersection__of__two__arrays_8cpp.html
+++ b/de/dc5/intersection__of__two__arrays_8cpp.html
@@ -222,12 +222,12 @@ Here is the call graph for this function: