Print Matrix in spiral form ( 2-D array)

  Рет қаралды 123,433

Vivekanand Khyade - Algorithm Every Day

Vivekanand Khyade - Algorithm Every Day

7 жыл бұрын

Print matrix in spiral form. Print the 2-D array in spiral form.

Пікірлер: 152
@HendersonHood
@HendersonHood 4 жыл бұрын
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
@Jerry-by7cj
@Jerry-by7cj 5 жыл бұрын
Easy to understand, thank you so much! Impressive!
@jaswanthreddythummuru2210
@jaswanthreddythummuru2210 3 жыл бұрын
You nailed it!. Clear-Cut explanation. Keep posting algorithms.
@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 !
@huzaifashaikh932
@huzaifashaikh932 2 жыл бұрын
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.
@59595915
@59595915 4 жыл бұрын
Awesome! Very simple and clear solution!
@krishnaghosh1126
@krishnaghosh1126 6 жыл бұрын
Tomorrow is my ISC computer science practical 2018 ...this video is so helpful... great explanation sir😊
@GautamThapa-xs6ns
@GautamThapa-xs6ns 2 жыл бұрын
So satisfied with your explanation thanks!
@azeeztaiwo2802
@azeeztaiwo2802 5 жыл бұрын
you did a good job at explaining the way your algorithm work.
@ShinobiEngineer
@ShinobiEngineer 6 жыл бұрын
#include int main() { printf("THANK YOU ! ! !"); return 0; }
@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
@bryanblakeney8881
@bryanblakeney8881 5 жыл бұрын
Learning so much from your videos. Thanks
@Avinashkumar-sw3rj
@Avinashkumar-sw3rj 4 жыл бұрын
Thanks a lot.way of explaining is awesome.
@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.
@rickychaitanya5216
@rickychaitanya5216 2 жыл бұрын
The best exaplaination soo far :) Thank you sir
@gujjulapradeepreddy3189
@gujjulapradeepreddy3189 3 жыл бұрын
Excellent explanation. Please upload more and more algorithms. Really the best explanation for complex algorithms.
@sazisgetaways1460
@sazisgetaways1460 2 жыл бұрын
You nailed it. Thank you... beautifully explained
@gammax5446
@gammax5446 5 жыл бұрын
thanks for our explaination...Great work!!
@tuhinchandra8675
@tuhinchandra8675 2 жыл бұрын
Sir my heartiest thanks to u...❤️ amazing explanation.. I was struggling with this question for my practicalsss... Finally I understood the logic🙏
@shivakumarpatil2952
@shivakumarpatil2952 4 жыл бұрын
Very nice and clear explanation. Helped a lot.
@kaveridhore4398
@kaveridhore4398 Жыл бұрын
This problem is tough for beginner and you made this an easy! Thankyou so much.
@AashishKumar-or9lu
@AashishKumar-or9lu 2 жыл бұрын
Love from Nepal ! Sir you describe from scratch like a pro
@prashanttiwari120
@prashanttiwari120 6 жыл бұрын
great source to learn programming
@Kaifa_ali
@Kaifa_ali 6 жыл бұрын
very nice explaination youre killing it
@armanmanukyan1970
@armanmanukyan1970 3 жыл бұрын
Excellent explanation. Many thanks.
@shubhamaths
@shubhamaths Жыл бұрын
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.
@VishnuPillai02
@VishnuPillai02 6 жыл бұрын
Thank You :) Well Explained.
@deniserea4774
@deniserea4774 2 жыл бұрын
Muy buena explicación!! Gracias
@shamaparween7655
@shamaparween7655 5 жыл бұрын
Ur explaination way is very gud..
@nitin-vlogs3189
@nitin-vlogs3189 3 жыл бұрын
Your explanation is awesome sir
@neelparekh3448
@neelparekh3448 3 жыл бұрын
Well explained and to the point. You've gained another subscriber.
@hoanganh7997
@hoanganh7997 2 жыл бұрын
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 :)))
@dhirajsinha8102
@dhirajsinha8102 4 жыл бұрын
best explanation thank you for existing
@danithakare889
@danithakare889 Жыл бұрын
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
@bhavyar2986
@bhavyar2986 5 жыл бұрын
amazing!! happy to subscribe!
@riyanegi7502
@riyanegi7502 3 жыл бұрын
Well explained!! Each and every step was made clear . I really liked the way you explained
@mdtaha2335
@mdtaha2335 2 жыл бұрын
apko coding ata hai
@ManishGupta-uj2kk
@ManishGupta-uj2kk 5 жыл бұрын
i'm fan of your explanation......thnx.
@alyonachmil9781
@alyonachmil9781 Жыл бұрын
Thanks. Very useful and understandable.
@sr_sudipta
@sr_sudipta 4 жыл бұрын
It was simply awesome........thanks sir....
@jokeofgames1409
@jokeofgames1409 Жыл бұрын
Beautifully explanained
@NishantRathoreXYZ
@NishantRathoreXYZ 10 ай бұрын
Very helpful for me this video sir, I want to your all videos watch regularly jai hind for your motivation sir.
@dhruvinbhatt6414
@dhruvinbhatt6414 Жыл бұрын
Very well explained 👍👍, thanks sir
@analyticstamizan677
@analyticstamizan677 4 жыл бұрын
superb...explaination sir..
@ridhamkaria8771
@ridhamkaria8771 5 жыл бұрын
explanation was from basic.Nice one. make a video on structure problems.
@praveenraj8674
@praveenraj8674 5 жыл бұрын
Superb explanation
@manasranjan4
@manasranjan4 6 жыл бұрын
Really very nice explanation. Great man
@softwareengineering101
@softwareengineering101 Жыл бұрын
Awesome explanation
@atanasgeorgiev7073
@atanasgeorgiev7073 6 жыл бұрын
THANK YOU!!! :)
@riaganesha
@riaganesha 4 жыл бұрын
Awesome video 👏🏻
@ganeshjaggineni4097
@ganeshjaggineni4097 9 ай бұрын
NICE SUPER EXCELLENT MOTIVATED
@rudrajha1002
@rudrajha1002 10 ай бұрын
Superb sir...❤
@Ashwanikumar-qr2jj
@Ashwanikumar-qr2jj 2 жыл бұрын
best explanation for beginners.
@dileepkumarnag4967
@dileepkumarnag4967 5 жыл бұрын
very nice explanation sir
@kidsfun381
@kidsfun381 5 жыл бұрын
Realy nice explanation
@girishtoshniwal5563
@girishtoshniwal5563 3 жыл бұрын
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'.
@renjithr7676
@renjithr7676 5 жыл бұрын
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 3 жыл бұрын
@@PrashantNigam No, not exactly. The Java naming convention is camel case, not underscores. So firstCol and firstRow &c are much better.
@vishwasmukund
@vishwasmukund 6 жыл бұрын
Nice series !! Can you please cover matrix rotation clockwise and anti clockwise when you get a chance ?
@__sarik
@__sarik 3 жыл бұрын
really good explanation
@divyansheevarshney2476
@divyansheevarshney2476 3 жыл бұрын
awsmm explanation
@banothramesh9021
@banothramesh9021 5 жыл бұрын
Sir thanks for good explanation I need different type of output with explanation and explain what conditions are used
@sonubansal6220
@sonubansal6220 3 жыл бұрын
it helped me alot thanks
@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.
@sandeepraja1470
@sandeepraja1470 5 жыл бұрын
Can you please explain the logic to print a matrix in spiral form starting from center (printing outwards)?
@sarojsahoo8763
@sarojsahoo8763 4 жыл бұрын
Thanks a lot !
@ZuleyenineIbneNoman
@ZuleyenineIbneNoman 4 жыл бұрын
hey bro,I watched your video and you did a great job.pls make a video on backtracking and sieve of eratosthenes
@nasiruddinkhan5665
@nasiruddinkhan5665 5 жыл бұрын
very well explained
@kiranbs5057
@kiranbs5057 3 жыл бұрын
Good Job . Thank you
@rosonerri-faithful
@rosonerri-faithful 3 жыл бұрын
Thank you Sir. It was helpful 😄. Can you post the explanation video for Goldmine collection and sudoku problem?
@AshwaniKumar-bh8rl
@AshwaniKumar-bh8rl 5 жыл бұрын
nice explanation
@ermattonella
@ermattonella 4 жыл бұрын
THANKS FOR THE HELP SIR
@kiranki2007
@kiranki2007 4 жыл бұрын
Well explained .
@darshansolanki5535
@darshansolanki5535 3 жыл бұрын
You are the best
@anandraj9859
@anandraj9859 2 жыл бұрын
Explanation 🔥🔥🔥🔥🔥🔥🔥
@abhinavjangra7446
@abhinavjangra7446 6 жыл бұрын
Print matrix diagonally ..??
@the-gray-haired-developer
@the-gray-haired-developer 5 жыл бұрын
please add more videos on matrix related problems
@vishalkajale5073
@vishalkajale5073 3 жыл бұрын
good explanation.
@user-bi4gr7mr9g
@user-bi4gr7mr9g 3 жыл бұрын
Thank you so much friend!! Now I can say easy-peasy, lemon squeezy 'bout this task!
@rishavraj3547
@rishavraj3547 2 жыл бұрын
Are you cs go player 😂
@sssumeet
@sssumeet 2 жыл бұрын
🙌
@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!
@koushikkumar481
@koushikkumar481 Ай бұрын
where are you sir your explanations are awesome hats off
@software85696
@software85696 3 жыл бұрын
Does this algorithm work if the number of rows >= to the number of columns?
@rishikumarvirenkumarmehta9635
@rishikumarvirenkumarmehta9635 3 жыл бұрын
Thank you so much.....
@9-1939
@9-1939 2 жыл бұрын
🔥🔥
@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
@saketpanchori6480
@saketpanchori6480 5 жыл бұрын
can you tell me how to use this in main function?
@dhananjayjadhav7064
@dhananjayjadhav7064 2 жыл бұрын
When I search for an que and got you vidio my face is like 😊😊😊
@NehaKumari-cx6un
@NehaKumari-cx6un 3 жыл бұрын
👌👌👌
@sam_s3344
@sam_s3344 2 жыл бұрын
Amazing explanation. Do you have the code for this?
@debojyotidas3260
@debojyotidas3260 6 жыл бұрын
Sir I have created the code of the matrix by my concept the program executed and displayed the matrix in spiral order but it shows array out of index.why is it showing it?
@balladofgaytony5725
@balladofgaytony5725 4 жыл бұрын
because there was a mistake in code on desk.in first for change i=1 to i=0; because first index of array is 0
@noobkirti8216
@noobkirti8216 2 жыл бұрын
Sir make video on objects oriented programming 🙏
@ankitabhise3883
@ankitabhise3883 3 жыл бұрын
How to do Reverse spiral matrix?
@qpwug8s1d7rhf
@qpwug8s1d7rhf 5 жыл бұрын
Nice explanation. Could get the same info in half the time though.
@gogoipe
@gogoipe 4 жыл бұрын
Thank you boy
@abhisekhagarwala9501
@abhisekhagarwala9501 5 жыл бұрын
sir i have implented exactly same code as yours but it prints some garbage value ...
@amritgupta1792
@amritgupta1792 6 жыл бұрын
jalwa hai bhai tera bhi
@utkarshgangwar4042
@utkarshgangwar4042 2 жыл бұрын
you are adorable Sir!
@STFTadka
@STFTadka 3 жыл бұрын
Thanks Sir
@easylearning9886
@easylearning9886 4 жыл бұрын
Thankyou
Print Matrix Diagonally (Diagonal order)
13:22
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 109 М.
My little bro is funny😁  @artur-boy
00:18
Andrey Grechka
Рет қаралды 13 МЛН
Please be kind🙏
00:34
ISSEI / いっせい
Рет қаралды 190 МЛН
когда повзрослела // EVA mash
00:40
EVA mash
Рет қаралды 3,6 МЛН
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
Рет қаралды 60 М.
Diameter of a Binary Tree (Code/ Algorithm)
17:15
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 93 М.
Mastery: How to Learn Anything Fast | Nishant Kasibhatla
19:10
Ideas & Inspiration
Рет қаралды 14 МЛН
6 Levels of Thinking Every Student MUST Master
17:12
Justin Sung
Рет қаралды 1 МЛН
Why Physics Is Hard
2:37
Professor Hafner
Рет қаралды 481 М.
Remove Duplicates from sorted Array
21:22
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 166 М.
3 Types of Algorithms Every Programmer Needs to Know
13:12
ForrestKnight
Рет қаралды 455 М.
Trick for spiral matrix traversal
10:12
Techdose
Рет қаралды 195 М.
My little bro is funny😁  @artur-boy
00:18
Andrey Grechka
Рет қаралды 13 МЛН