Concatenation of an array in C++

https://youtu.be/af2H_ac1kgk #include <iostream> #include <algorithm> using namespace std; int main() { int arr_size1 = 4; int arr_size2 = 5; int arr1[arr_size1] = {1, 2, 3, 4}; int arr2[arr_size2] = {5,…

Shifting an array in C++

https://youtu.be/TBmQdqc8FKg?si=BU8OWOLhyD__06wR #include <iostream> #include <algorithm> using namespace std; int main() { int arr_size = 5; int arr[arr_size] = {6, 7, 8, 9, 2}; int num_shifts = 2; rotate(arr, arr +…

std unordered set in C++

https://youtu.be/5lEUYLgyy68 #include <iostream> #include <unordered_set> using namespace std; int main() { unordered_set<int> us = {5, 4, -2, 9, 8}; us.insert(100); us.insert({40, 50, 60}); us.erase(-2); for (auto e : us) {…

Search for Data in a Set in C++

https://youtu.be/C4dBxcvyk5c #include <iostream> #include <set> using namespace std; int main() { set<int> s = {78, 8, 9, 4, 5, 3, 65, 40}; int value = 40; auto found = s.find(value);…

Set Member Functions in C++

https://youtu.be/we7pvugzWk8?si=DC7zpwtPw0u-lSzb #include <iostream> #include <set> using namespace std; int main() { set<int> s = {9, 5, 4, 7, 83, 90}; cout << "Set size is : " << s.size() <<…

Deleting a Single Value from a Vector in C++

https://youtu.be/Gzdenp3OZ48?si=ovpigthygEnZRU6w #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> v = {67, 3, 5, 7, 9, 1}; v.erase(v.begin() + 1); for (auto el : v)…

Lambda Expressions in C++

Lambda expressions are anonymous unnamed function objects. https://youtu.be/iUtyX8c1pIw #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int i = 30; int x = 50; auto lambda…

Min and Max Elements in C++

https://youtu.be/hzus6dhSIhw?si=HyP0x6n6DUtVhUfJ #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> v = {6, 5, 9, 8, 50, 311, 22}; // auto it = max_element(begin(v), end(v)); auto…

std copy function in C++

https://youtu.be/Tyt060FRiS8?si=rKxV8SYqUsG56lhE #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> copy_from_vector = {5, 7, 8, 9, 0, 10}; vector<int> copy_to_vector(6); copy(copy_from_vector.begin(), copy_from_vector.begin() + 3, copy_to_vector.begin()); for…