How To Reverse An Array | Multiple Approaches | C++ | Optimal Approach - Swapping | 2 Pointers

How To Reverse An Array | Multiple Approaches | C++ | Optimal Approach - Swapping | 2 Pointers

CodeWithVD

54 года назад

691 Просмотров

In this video, we will solve the problem of reversing the elements in the given array, irrespective of the data type of the elements present, via an optimal approach of swapping elements.

We will also look at the C++ code for the optimal approach and C++ inbuilt function to reverse the array, i.e., reverse().

This is the first problem of love Babbar's 450 sheet from the array section.

Link to problem
GFG Link: https://practice.geeksforgeeks.org/problems/reverse-an-array/0
Leetcode Link: https://leetcode.com/problems/reverse-string/

Timecodes
0:00 - Problem Statement - What it means to reverse an array?
1:01 - Approach 1 - Solution using extra memory - O(n) space
4:24 - Approach2 - 2 Pointer Approach - Optimal Approach
6:59 - Time and space complexity of 2 pointer approach
8:04 - Inbuilt reverse function in C++
9:16 - C++ code for 2 Pointer approach (Optimal Approach)
12:01 - C++ Inbuilt reverse function


Tags
How to reverse an array
reverse an array in c++
reversing the elements in the array
reverse array by swapping elements
swapping elements in the array
2 pointer approach to reverse the array
2 pointer approach
Love Babbar sheet
Love Babbar 450 sheet
Lover Babbar DSA cracker sheet
how to reverse an array in c++ using pointer
write a program to reverse an array
write a program in c++ to print reverse of an array
c++ program to reverse an array elements
how to reverse array with pointer in c++
pointers,arrays and pointers
reverse a array in a optimal way
c++ program to print array in reverse order
reverse array using pointer
reverse array elements using pointer
reverse an array in c
reverse an array in c++
reverse string
reverse an array
Arrays
array
Data Structures
Algorithms
Data Structures and Algorithms
Coding
fang
mang

Тэги:

#How_to_reverse_an_array #reverse_an_array #reversing_the_elements_in_the_array #reverse_array_by_swapping_elements #2_pointer_approach_to_reverse_the_array #Love_Babbar_sheet #Love_Babbar_450_sheet #Lover_Babbar_DSA_cracker_sheet #write_a_program_to_reverse_an_array #write_a_program_in_c++_to_print_reverse_of_an_array #c++_program_to_reverse_an_array_elements #reverse_a_array_in_a_optimal_way #c++_program_to_print_array_in_reverse_order #reverse_an_array_in_c++ #2_pointer
Ссылки и html тэги не поддерживаются


Комментарии:


Аргентинские банки и банковские карты, покупки по банковским картам Следите за руками - сериал о крипте и недвижимости