How To Reverse An Array In JAVA | FREE DSA Course in JAVA | Lecture 63
ฝัง
- เผยแพร่เมื่อ 30 ม.ค. 2023
- We are covering simple java operations on arrays.
In this program, we will learn how to reverse an array.
For example, we have an array, 1, 5, 6, 79, 80, 60, 23 then we must reverse the array in the sense that it now becomes 23, 60, 80, 79, 6, 5, 1
We can solve this program using loops by placing one pointer at the start of the array and another pointer at the end of the array.
All we need to do now is interchange their positions and increase the initial pointer by one and decrease the last pointer by one.
Let's check out how we can write a java program to reverse an array.
For more information, fill out this form: forms.gle/8eiUmM92Fx563Aen9
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacademy.com
#java #array #arrayjava #dsa #dsacourse #placement #job
thank you for this simplest explanation ever :)
Thank you this question is solved
just looking like wow
superb sir
the best explanation i have ever seen
amazing explanation sir....!
this is the your first video that I'm watching... and I love it.
this is really easy to understand thank you!
int j = last element of array a[i] solved my problem , thanks a lot sir
kl rahul's 4th cousin
🤣🤣
Sir You're Awesome.
Great video sir. This is very good video and please make on video on DSA topic as well.
Awesome..... simple explanation..... 💯💯
Simple super sir ❤️
Sir can you cover dynamic programming and make a playlist ?
nice explanation
what was the time & space complexity of this code ????
we can do the same thing by using for(int i=a.length-1;i>=0;i--)
Sysout(a[i]+" ");
Why do wee need to create aethod and them calling using while??
Thank you so much
thanks
super sir
So easy
i did not got output
We don't need to swap we can also do these by:
for(i=A.length; i>=0;i--){
sout(A[i]);
It will take just 10 lines and also save our time.
you can't do that in a function where you need to return a reversed array.
Why is easier questions being posted today ?
These are some basic operations that students must know. Will come up more advanced questions as well.
❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤
why don't you teach on board that will be easy for us to understand and i personally like more beacuse it's to irritating when u tell the concept on virtual mode. I hope u will consider my request
this code is appearing [I@5fdef03a an not get output