|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implementation for the Array right Rotation algorithm. More...
#include <cassert>#include <iostream>#include <vector>Namespaces | |
| namespace | operations_on_datastructures |
| for std::vector | |
| namespace | tests |
| Testcases to check Union of Two Arrays. | |
Functions | |
| void | operations_on_datastructures::print (const std::vector< int32_t > &array) |
| Prints the values of a vector sequentially, ending with a newline character. More... | |
| std::vector< int32_t > | operations_on_datastructures::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... | |
| void | tests::test1 () |
| A Test to check an simple case. More... | |
| void | tests::test2 () |
| A Test to check an empty vector. More... | |
| void | tests::test3 () |
| A Test to check an invalid shift value. More... | |
| void | tests::test4 () |
| A Test to check a very large input. More... | |
| void | tests::test5 () |
| A Test to check a shift of zero. More... | |
| static void | test () |
| Function to test the correctness of shift_right() function. More... | |
| int | main () |
| main function More... | |
Implementation for the Array right Rotation algorithm.
Shifting an array to the right involves moving each element of the array so that it occupies a position of a certain shift value after its current one. This implementation uses a result vector and does not mutate the input.
| int main | ( | void | ) |
|
static |
Function to test the correctness of shift_right() function.