filmov
tv
How To Reverse an Array in C++ (Multiple Approaches) (Hindi) | Arrays
Показать описание
How To Reverse an Array in C++(Multiple Approaches)(Hindi) | Arrays
Hi
Welcome To our channel Code Bashers.
About Video:
In this video i have discussed different approaches for reversing an array. First approach is to make a new array and traverse the input array for behind , while traversing the array put each element in the new array and when the traversal is complete return the new array. Second approach is the two pointer approach where in we declare two variables , initialise one with 0 index and other with index n-1, now we will swap the values of this pointer and then increment the start pointer and decrement the end pointer and when start becomes greater than or equal to end our loops break.
See video for explanation with example and dry run.
Queries Covered in this video:
1) Approach to reverse the array.
2) Complexity Discussion for different approaches used to reverse array.
3) code for reversing the array.
Complexity Discussion:
Approach 1:
space complexity = O(N)
time complexity = O(N)
Approach 2:
space complexity = O(1)
time complexity = O(N)
#reversearray #arrays #code
Please Like , Share , Subscribe and forward it to your friends.
Thank You
Links to previous videos:
Find Second Largest Number in an Array(Multiple Approaches)(Hindi) || Array Data Structure:
find minimum and maximum value in array C++ | Arrays:
About Channel:
Our channel make videos related to programming. I hope my content helps you land the job of your dreams and become a better engineer!
Hi
Welcome To our channel Code Bashers.
About Video:
In this video i have discussed different approaches for reversing an array. First approach is to make a new array and traverse the input array for behind , while traversing the array put each element in the new array and when the traversal is complete return the new array. Second approach is the two pointer approach where in we declare two variables , initialise one with 0 index and other with index n-1, now we will swap the values of this pointer and then increment the start pointer and decrement the end pointer and when start becomes greater than or equal to end our loops break.
See video for explanation with example and dry run.
Queries Covered in this video:
1) Approach to reverse the array.
2) Complexity Discussion for different approaches used to reverse array.
3) code for reversing the array.
Complexity Discussion:
Approach 1:
space complexity = O(N)
time complexity = O(N)
Approach 2:
space complexity = O(1)
time complexity = O(N)
#reversearray #arrays #code
Please Like , Share , Subscribe and forward it to your friends.
Thank You
Links to previous videos:
Find Second Largest Number in an Array(Multiple Approaches)(Hindi) || Array Data Structure:
find minimum and maximum value in array C++ | Arrays:
About Channel:
Our channel make videos related to programming. I hope my content helps you land the job of your dreams and become a better engineer!
Комментарии