The return statement in Java

https://youtu.be/Y2kJ3SbecNQ?si=lI009ORGlXcxcCMn import java.util.*; public class ReturnEx { public static void main(String[] args) { boolean value = true; System.out.println("Before return statment."); if (value) return; System.out.println("This will not be printed."); } }

Using break to Exit a Loop in Java

https://youtu.be/tHmHfl2Yygc import java.util.*; public class ExitLoop { public static void main(String[] args) { int i = 0; while (i < 100) { if (i == 20) break; System.out.println("i : "…

The ArrayDeque Class in Java

https://youtu.be/Mzkwih-Su7o?si=aooeRrQ4BrxbUl4w import java.util.*; public class ArrayDQ { public static void main(String[] args) { ArrayDeque<String> ad = new ArrayDeque<String>(); ad.push("a"); ad.push("b"); ad.push("c"); ad.push("d"); while (ad.peek() != null) { System.out.print(ad.pop() + "…

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);…