Reverse An Array

preview_player
Показать описание
JOIN ME
—————

COMPLETE PLAYLIST
————————————

INTERVIEW PLAYLIST
————————————

QUICK SHORT VIDEOS
————————————-

Time Lines
=========
0:05 Introduction
0:34 Approach
2:24 Code Explanation

This video is for beginners, I have used a for loop to swap the elements in the array, and this video covers how to reverse the same array, I mean reverse in-place.

This is mainly asked to freshers, but sometime we can see this questions in experienced candidate interviews also. Basically it checked how much fast you think and quickly implement in code.

Do let me know if there is any doubt regarding this video or any other topic, I will do my best to answer you.

Thanks,
CppNuts

#Array #ArrayReverse #DataStructure #Algorithms #InterviewQuestions #ComputerScience
Рекомендации по теме
Комментарии
Автор

#python code for this---
def reverse_array(arr):
n=len(arr)
for i in range(n//2):
arr[i], arr[n-i-1]=arr[n-i-1], arr[i]
return arr
arr=[int(x) for x in input().split ()]
print(reverse_array(arr))

yashavantsingh
Автор

please upload atleast one video a day of this playlist with consistency, so it is very helpful us to maintain consistency with you.
At last your content is gem

raeesjamadar
Автор

Yes exactly what i wanted. Explain to me like I'm a baby. Thank you so much.

akarshgupta
Автор

is there more array questions other than 15 which you added?

suparnaanand
Автор

#python
l=[1, 2, 3, 4, 4, 5]
for i in range(len(l), 0, -1):
print(i, end=' ')

akshatchauhan
Автор

Hey man love your vids,
Would be really happy if you could make a sfml tutorial
Or pls link it for me if you already have one

ramasubbu
Автор

this is realy very important questin, which was also ask in my inteview and i solved with same method

IjazAhmad-wvqx
Автор

#python
import array
a=array.array('i', [1, 2, 3, 4, 5])
print(list(a[::-1]))

akshatchauhan
Автор

Dear Sir, you told for uploading vptr, virtual table concept in virtual function series but still that video is not visible in that list. Can you please share the link for virtual table concept here.

AJAYKUMAR-glvx
Автор

which language you are using in this program?
I have tried this with javascript it is not working.

amitmane
Автор

your code for swap is not exact your code is swapping index 0 & index 5
exact code for swap
for(int i=0;i<len/2;i++)
{
swap(arr[i], arr[len-i]);
}

asharafzal
Автор

// Reverse the array
var reversedArray = a.reverse();

console.log(reversedArray);

Instead of this we use array methods

kamalakkannan
welcome to shbcf.ru