Print Matrix in spiral form ( 2-D array)

  Рет қаралды 124,885

Vivekanand Khyade - Algorithm Every Day

Vivekanand Khyade - Algorithm Every Day

Күн бұрын

Пікірлер: 153
@HendersonHood
@HendersonHood 5 жыл бұрын
Very artfully described; this is by far the best explanation I have seen describing this algorithm.
@volcanopz6243
@volcanopz6243 3 жыл бұрын
I cannot believe how easy this was, Thank you for such great explanation
@huzaifashaikh932
@huzaifashaikh932 3 жыл бұрын
I searched whole youtube but still wasn't satisfied with explanation, I got satisfied with only your explanation, it's the best explanation! keep posting new videos.
@ShinobiEngineer
@ShinobiEngineer 6 жыл бұрын
#include int main() { printf("THANK YOU ! ! !"); return 0; }
@daumtto
@daumtto 5 жыл бұрын
Thank you sir. I think it was beyond my capabiliity of solving.. you made me understand this algorithm!
@aniketkhare8635
@aniketkhare8635 3 жыл бұрын
everything explained in a simple and easy manner. Thanks a lot !
@gujjulapradeepreddy3189
@gujjulapradeepreddy3189 4 жыл бұрын
Excellent explanation. Please upload more and more algorithms. Really the best explanation for complex algorithms.
@hoanganh7997
@hoanganh7997 3 жыл бұрын
i listen to a guy speak my mother language explain this and don't understand anything but i can understand it when listen to you , that't magical :)))
@jaswanthreddythummuru2210
@jaswanthreddythummuru2210 4 жыл бұрын
You nailed it!. Clear-Cut explanation. Keep posting algorithms.
@shubhamaths
@shubhamaths 2 жыл бұрын
Well explained ❤️ ignoring this video because of the Thumbnail but after watching all videos and still not understanding.. Then I clicked on this. ❤️ Agin it proves.. Don't judge a book by it's cover.
@kaveridhore4398
@kaveridhore4398 Жыл бұрын
This problem is tough for beginner and you made this an easy! Thankyou so much.
@NishantTaletiya
@NishantTaletiya Жыл бұрын
bahot bahot dhnyawad aapka. You explained it very easy and in briefly i understand it easily i think its very difficult but after your explaination it look like so easy.
@tapanjeetroy8266
@tapanjeetroy8266 5 жыл бұрын
Thanks for uploading it.. You are doing a great great job.. Please please upload more of such programming questions.. We really need it
@Jerry-by7cj
@Jerry-by7cj 6 жыл бұрын
Easy to understand, thank you so much! Impressive!
@AashishKumar-or9lu
@AashishKumar-or9lu 3 жыл бұрын
Love from Nepal ! Sir you describe from scratch like a pro
@riyanegi7502
@riyanegi7502 4 жыл бұрын
Well explained!! Each and every step was made clear . I really liked the way you explained
@mdtaha2335
@mdtaha2335 2 жыл бұрын
apko coding ata hai
@azeeztaiwo2802
@azeeztaiwo2802 5 жыл бұрын
you did a good job at explaining the way your algorithm work.
@danithakare889
@danithakare889 2 жыл бұрын
sir you are really great mentor to teach alogoritham please to be continue and help us we are ready to take paid up subscription also
@sazisgetaways1460
@sazisgetaways1460 2 жыл бұрын
You nailed it. Thank you... beautifully explained
@shivakumarpatil2952
@shivakumarpatil2952 4 жыл бұрын
Very nice and clear explanation. Helped a lot.
@59595915
@59595915 4 жыл бұрын
Awesome! Very simple and clear solution!
@nitin-vlogs3189
@nitin-vlogs3189 4 жыл бұрын
Your explanation is awesome sir
@neelparekh3448
@neelparekh3448 4 жыл бұрын
Well explained and to the point. You've gained another subscriber.
@Avinashkumar-sw3rj
@Avinashkumar-sw3rj 5 жыл бұрын
Thanks a lot.way of explaining is awesome.
@NishantRathoreXYZ
@NishantRathoreXYZ Жыл бұрын
Very helpful for me this video sir, I want to your all videos watch regularly jai hind for your motivation sir.
@rickychaitanya5216
@rickychaitanya5216 3 жыл бұрын
The best exaplaination soo far :) Thank you sir
@renjithr7676
@renjithr7676 6 жыл бұрын
very nice Explanation. Algorithm would be super cool to understand if you change l to first_column and k to first_row
@PrashantNigam
@PrashantNigam 5 жыл бұрын
exactly
@SpectatorAlius
@SpectatorAlius 4 жыл бұрын
@@PrashantNigam No, not exactly. The Java naming convention is camel case, not underscores. So firstCol and firstRow &c are much better.
@girishtoshniwal5563
@girishtoshniwal5563 4 жыл бұрын
This is really crystal clear explanation. However, don't you think two if conditions outside for loops got interchanged? Because when columns are variable, you should refer to variable 'L' in if condition instead of 'k' and when rows are variable, you should refer to variable 'k' instead of 'L'.
@krishnaghosh1126
@krishnaghosh1126 6 жыл бұрын
Tomorrow is my ISC computer science practical 2018 ...this video is so helpful... great explanation sir😊
@GautamThapa-xs6ns
@GautamThapa-xs6ns 3 жыл бұрын
So satisfied with your explanation thanks!
@ManishGupta-uj2kk
@ManishGupta-uj2kk 6 жыл бұрын
i'm fan of your explanation......thnx.
@jokeofgames1409
@jokeofgames1409 2 жыл бұрын
Beautifully explanained
@tuhinchandra8675
@tuhinchandra8675 3 жыл бұрын
Sir my heartiest thanks to u...❤️ amazing explanation.. I was struggling with this question for my practicalsss... Finally I understood the logic🙏
@dhruvinbhatt6414
@dhruvinbhatt6414 Жыл бұрын
Very well explained 👍👍, thanks sir
@dhirajsinha8102
@dhirajsinha8102 5 жыл бұрын
best explanation thank you for existing
@armanmanukyan1970
@armanmanukyan1970 4 жыл бұрын
Excellent explanation. Many thanks.
@bryanblakeney8881
@bryanblakeney8881 6 жыл бұрын
Learning so much from your videos. Thanks
@shamaparween7655
@shamaparween7655 6 жыл бұрын
Ur explaination way is very gud..
@deniserea4774
@deniserea4774 3 жыл бұрын
Muy buena explicación!! Gracias
@manasranjan4
@manasranjan4 6 жыл бұрын
Really very nice explanation. Great man
@alyonachmil9781
@alyonachmil9781 2 жыл бұрын
Thanks. Very useful and understandable.
@bhupeshdavesar
@bhupeshdavesar 4 жыл бұрын
[Solved the exceptions and edge cases] good explanation but the solution gives wrong results(extra values) for 4*5 arrays, it gives 21 values instead of 20 , gives 26 instead of 24 for 4* 6 , throws exception for 2*5. One possible measure is, instead of printing in each loop , collect output in ArrayList using .add instead of prints and introduce a variable count (int count = m * n ) and check count < list.size and break the while loop if count == list.size Code for reference public static void main(String[] args) { System.out.println(printSpiral( new int[][] { { 4, 5, 3, 3, 6 }, { 4, 5, 1, 7, 8 }, { 4, 5, 3, 3, 6 }, { 4, 5, 1, 7, 8 }})); } private static List printSpiral(int[][] arr) { // printSpiral(arr, 4, 5); return printSpiral(arr, arr.length, arr[0].length); } private static List printSpiral(int[][] arr, int m, int n) { List outputList = new ArrayList(); int firstRow = 0, firstColumn = 0, lastColmn = n - 1, lastRow = m - 1, elementCount = m * n; while (firstRow
@ridhamkaria8771
@ridhamkaria8771 6 жыл бұрын
explanation was from basic.Nice one. make a video on structure problems.
@АсылжанБотахан-ъ7э
@АсылжанБотахан-ъ7э 3 жыл бұрын
Thank you so much friend!! Now I can say easy-peasy, lemon squeezy 'bout this task!
@rishavraj3547
@rishavraj3547 3 жыл бұрын
Are you cs go player 😂
@sr_sudipta
@sr_sudipta 4 жыл бұрын
It was simply awesome........thanks sir....
@Ashwanikumar-qr2jj
@Ashwanikumar-qr2jj 2 жыл бұрын
best explanation for beginners.
@ganeshjaggineni4097
@ganeshjaggineni4097 Жыл бұрын
NICE SUPER EXCELLENT MOTIVATED
@dileepkumarnag4967
@dileepkumarnag4967 5 жыл бұрын
very nice explanation sir
@Kaifa_ali
@Kaifa_ali 6 жыл бұрын
very nice explaination youre killing it
@adolfocarrillo248
@adolfocarrillo248 4 жыл бұрын
Challenge here. Can you design an algorithm which prints out a line corresponding to a certain line equation? The line must be printed on a square Matrix, with any symbol you want like asterisks.
@VishnuPillai02
@VishnuPillai02 6 жыл бұрын
Thank You :) Well Explained.
@softwareengineering101
@softwareengineering101 2 жыл бұрын
Awesome explanation
@analyticstamizan677
@analyticstamizan677 4 жыл бұрын
superb...explaination sir..
@mchapman0071
@mchapman0071 6 жыл бұрын
Hi, first of all thanks for this explanation! It really helped. I also have a question. Why did you create the if statements k
@ArunKumarKarepu
@ArunKumarKarepu 6 жыл бұрын
After while condition is satisfied, k is increased by one after first for loop and last_col is decreased by one after second for loop. So in order to traverse other values, these conditions needs to be checked.
@annakhomidova4687
@annakhomidova4687 2 жыл бұрын
Thanks a lot for explanation! This is wery helpful!
@rudrajha1002
@rudrajha1002 Ай бұрын
God for this question sir !!!!💕💕💕💕💕💕💕💕💕💕😊😊😍😍
@dhananjayjadhav7064
@dhananjayjadhav7064 3 жыл бұрын
When I search for an que and got you vidio my face is like 😊😊😊
@rosonerri-faithful
@rosonerri-faithful 3 жыл бұрын
Thank you Sir. It was helpful 😄. Can you post the explanation video for Goldmine collection and sudoku problem?
@koushikkumar481
@koushikkumar481 6 ай бұрын
where are you sir your explanations are awesome hats off
@__sarik
@__sarik 4 жыл бұрын
really good explanation
@praveenraj8674
@praveenraj8674 6 жыл бұрын
Superb explanation
@rudrajha1002
@rudrajha1002 Жыл бұрын
Superb sir...❤
@gammax5446
@gammax5446 5 жыл бұрын
thanks for our explaination...Great work!!
@vimalv6341
@vimalv6341 3 жыл бұрын
very well explained but only one thing was missing i.e complexity by the way complexity is O(m*n)
@darshansolanki5535
@darshansolanki5535 4 жыл бұрын
You are the best
@software85696
@software85696 3 жыл бұрын
Does this algorithm work if the number of rows >= to the number of columns?
@sonubansal6220
@sonubansal6220 4 жыл бұрын
it helped me alot thanks
@vishalkajale5073
@vishalkajale5073 4 жыл бұрын
good explanation.
@ZuleyenineIbneNoman
@ZuleyenineIbneNoman 5 жыл бұрын
hey bro,I watched your video and you did a great job.pls make a video on backtracking and sieve of eratosthenes
@darkoluketic177
@darkoluketic177 4 жыл бұрын
Rely bro u are the best.... u make this for idiots like me... sub
@prashanttiwari120
@prashanttiwari120 7 жыл бұрын
great source to learn programming
@RichValuedIndia
@RichValuedIndia 5 жыл бұрын
*TQ bro* tmrw is my exam 😍
@divyansheevarshney2476
@divyansheevarshney2476 4 жыл бұрын
awsmm explanation
@anandraj9859
@anandraj9859 3 жыл бұрын
Explanation 🔥🔥🔥🔥🔥🔥🔥
@riaganesha
@riaganesha 5 жыл бұрын
Awesome video 👏🏻
@kiranbs5057
@kiranbs5057 3 жыл бұрын
Good Job . Thank you
@sandeepraja1470
@sandeepraja1470 6 жыл бұрын
Can you please explain the logic to print a matrix in spiral form starting from center (printing outwards)?
@orkhanibrahim
@orkhanibrahim 3 жыл бұрын
what about printing not from row and column index from 0,0 .For example how can we print from 1,1
@bhavyar2986
@bhavyar2986 5 жыл бұрын
amazing!! happy to subscribe!
@kidsfun381
@kidsfun381 5 жыл бұрын
Realy nice explanation
@vishwasmukund
@vishwasmukund 6 жыл бұрын
Nice series !! Can you please cover matrix rotation clockwise and anti clockwise when you get a chance ?
@noobkirti8216
@noobkirti8216 2 жыл бұрын
Sir make video on objects oriented programming 🙏
@ermattonella
@ermattonella 4 жыл бұрын
THANKS FOR THE HELP SIR
@abhinavjangra7446
@abhinavjangra7446 6 жыл бұрын
Print matrix diagonally ..??
@nasiruddinkhan5665
@nasiruddinkhan5665 5 жыл бұрын
very well explained
@abhisekhagarwala9501
@abhisekhagarwala9501 5 жыл бұрын
sir i have implented exactly same code as yours but it prints some garbage value ...
@sam_s3344
@sam_s3344 2 жыл бұрын
Amazing explanation. Do you have the code for this?
@rishikumarvirenkumarmehta9635
@rishikumarvirenkumarmehta9635 4 жыл бұрын
Thank you so much.....
@banothramesh9021
@banothramesh9021 6 жыл бұрын
Sir thanks for good explanation I need different type of output with explanation and explain what conditions are used
@kiranki2007
@kiranki2007 5 жыл бұрын
Well explained .
@atanasgeorgiev7073
@atanasgeorgiev7073 7 жыл бұрын
THANK YOU!!! :)
@tarungoyal2113
@tarungoyal2113 3 жыл бұрын
nice explanation don't focus on these 40 ppl they are mad
@smbehindyou
@smbehindyou 7 жыл бұрын
the parent while block it should be - > while(k
@oggyjack64
@oggyjack64 6 жыл бұрын
you can right it also but in the previous line m-1 and n-1 were allocated to last_row and last_col respectievely...
@qpwug8s1d7rhf
@qpwug8s1d7rhf 6 жыл бұрын
Nice explanation. Could get the same info in half the time though.
@sssumeet
@sssumeet 2 жыл бұрын
🙌
@AshwaniKumar-bh8rl
@AshwaniKumar-bh8rl 6 жыл бұрын
nice explanation
@STFTadka
@STFTadka 3 жыл бұрын
Thanks Sir
@the-gray-haired-developer
@the-gray-haired-developer 5 жыл бұрын
please add more videos on matrix related problems
@akhilsinghsanoria1258
@akhilsinghsanoria1258 5 жыл бұрын
in step 3 we have to print last row ,so why we do not mention that we are printing lastrow
@ankitabhise3883
@ankitabhise3883 3 жыл бұрын
How to do Reverse spiral matrix?
@sarojsahoo8763
@sarojsahoo8763 4 жыл бұрын
Thanks a lot !
Print Matrix Diagonally (Diagonal order)
13:22
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 111 М.
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 16 МЛН
Remove Duplicates from sorted Array
21:22
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 173 М.
Print 2-D array in spiral order
10:13
mycodeschool
Рет қаралды 228 М.
Spiral Traversal of a Matrix | Spiral Matrix
16:33
take U forward
Рет қаралды 236 М.
This Algorithm is 1,606,240% FASTER
13:31
ThePrimeagen
Рет қаралды 851 М.
Rotate Matrix by 90 degrees clockwise | Rotate Image
8:23
Techdose
Рет қаралды 12 М.
Print a given matrix in spiral form | GeeksforGeeks
8:47
GeeksforGeeks
Рет қаралды 189 М.
Segregate 0's, 1's and  2's together in an array[O(n)](Dutch National Flag Problem)
17:27
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 61 М.
Trick for spiral matrix traversal
10:12
Techdose
Рет қаралды 211 М.
Zig Zag Array (spiral order array)
10:44
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 41 М.