Тёмный

Magic Square Construction Algorithm N × N 

Vivekanand Khyade - Algorithm Every Day
Подписаться 115 тыс.
Просмотров 113 тыс.
50% 1

Опубликовано:

 

20 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 146   
@mohamedatef3526
@mohamedatef3526 3 года назад
Thank you so much. This tutorial is the best. I would like to add just a little thing; The transpose of the magic square matrix follows the same properties discussed at the beginning of the video.
@nhlamuloreply5342
@nhlamuloreply5342 3 года назад
You have explained this method in a very simple and understanding way, thank you so much Mr
@patricepavelus4534
@patricepavelus4534 2 года назад
This is a really great video. I really hope that teachers in highschools explained this well. Thank you.
@giannizamora7247
@giannizamora7247 3 года назад
This was an amazing explanation, thank you!! also the clockwise and counterclockwise visualization helps to memorize the approach to this problem
@elianarthur6553
@elianarthur6553 2 года назад
one question why is does n equal 3 ?
@abdullahiabdislaan
@abdullahiabdislaan 2 года назад
@@elianarthur6553 n is numeber of row and columns
@b-designer
@b-designer 3 года назад
thank you soo much for your help, i've been searching for someone who can explain it like you. thx
@cesarl.c.847
@cesarl.c.847 3 года назад
Hello... to try other video with good explain, also can you to download Excel file to resolve Square Magic 3x3 and 5x5. To Find on RU-vid as: Creación Cuadrado Mágico lado impar - Creating Magic Square odd side.
@kiliankiel1250
@kiliankiel1250 4 года назад
Thank you for that very detailed and very precise explanation!
@personanongrata7976
@personanongrata7976 5 месяцев назад
Well done, sir! And many thanks. Subscribed!
@SivaKumar-sw6fb
@SivaKumar-sw6fb Год назад
Thank you for amazing explanation. Your teaching skill is very good.
@amanwehib8367
@amanwehib8367 2 года назад
You have made it easier to program in computer language. Thank you for that.
@BradenBest
@BradenBest 5 лет назад
This algorithm is incorrect as it does not fully map the domain for magic squares {x ∈ Z : x > 2} (the set of all integers greater than 2). Instead, it maps {2x + 1 : x ∈ Z : x > 0} (the set of all positive odd integers), which is _half_ of the problem domain. The title and premise of this video, on the other hand, incorrectly state that the domain is the expected {x ∈ Z : x > 2}. A good programmer does not implement only half of a solution. Imagine if Windows only did _half_ of what you need it to do. Imagine if your favorite game ended abruptly at the _halfway_ point. Imagine if your OS kernel only allocated _half_ of the resources you requested. Imagine if the write syscall only wrote _half_ of the text you put in. Imagine if your lazy employee only did _half_ of the work you assigned to them. Oh wait, you're already doing that. I wouldn't even be criticizing you if the title wasn't misleading. That said, click here to see my implementation: gist.github.com/bradenbest/af3c83230e11cf1b5aaeb05598398df6 Not only did I fully (as of this edit) implement the problem domain (it works with any n > 2 that doesn't overflow when n^2 or n(n^2+1)/2 are applied), but I did it using a 1 dimensional array. That might seem crazy, but 1D arrays afford a lot of advantages over 2D arrays, especially when it comes to filling, copying and allocating space for them. The 4n + 2 orders were the most complicated to implement. I based my algorithm on this article: www.1728.org/magicsq3.htm
@BradenBest
@BradenBest 5 лет назад
Also, rules iii. and iv. are overcomplicating things. The index can be expressed as `(n + i) mod n` where i is the index. Where n = 3 and % represents modulo division... (n + -3) % n = 0 % 3 = 0 (n + -2) % n = 1 % 3 = 1 (n + -1) % n = 2 % 3 = 2 (n + 0) % n = 3 % 3 = 0 (n + 1) % n = 4 % 3 = 1 (n + 2) % n = 5 % 3 = 2 (n + 3) % n = 6 % 3 = 0 As you can see, the expression correctly maps each value such that it "wraps" in both directions.
@jmvarquez
@jmvarquez 5 лет назад
I tried the algorithm and it is very well explained(it runs). and I did it 100% ... keep it up
@sarthakkar5130
@sarthakkar5130 6 лет назад
For a 3x3 matrix there will be 8 magic squares ,you just explained how to make one.What about the other 7 magic squares?
@santhanam2855
@santhanam2855 6 лет назад
rotation, reverse and mirroring. The same rule is available for left-top shifts,right-bottom and left-bottom shifts as well as the top-right shifts shown in this video.
@nhanthien36
@nhanthien36 2 года назад
thank teacher, i from VietNam. This video very useful, i love it
@muralinagarajan8305
@muralinagarajan8305 10 месяцев назад
Using your formula for creating magic squares, I feel it is possible to derive the magic sum. Can you show the same ?! Another clarification i have is, what happens if the common difference between subsequent numbers is more than one ?? And, how will the formula for the magic sum be affected if the common difference is more than one ??
@mrkhunt.
@mrkhunt. 4 года назад
Brilliant Algorithm and explanation!
@zehrxsyed
@zehrxsyed 4 года назад
thank you very much for such a good and detailed explanation sir.
@Ankit13555
@Ankit13555 6 лет назад
Explanation was really good BUT ...........my interest is to know keenly that how you deduce to reach upto this algo///////
@Justdailylife
@Justdailylife 5 лет назад
He is following a book, Introduction to Algorithm
@guillermodarioacostacabrer2291
@guillermodarioacostacabrer2291 4 года назад
@@Justdailylife Hi. Author of the book?
@rhythmshandlya9307
@rhythmshandlya9307 4 года назад
gfg
@animeshkumar1201
@animeshkumar1201 4 года назад
@@guillermodarioacostacabrer2291 CLRS
@ck4721
@ck4721 2 года назад
Wow what a clear explanation 🙏🙏👍👍👍👍👍👍 super super sir 👍👍👍👍
@surajtopal9940
@surajtopal9940 3 года назад
Thanks a lot sir ji , I have learn lot of thing from your channel
@biswajeet9826
@biswajeet9826 3 года назад
Better presentation and eye contact makes it more interesting.
@ChanchalDass
@ChanchalDass Год назад
0 1 2 3 0 8 3 9 14 34 1 2 12 13 7 34 2 11 16 6 1 34 3 15 5 4 10 34 58 36 36 32 32 36 With the given rule, I have created this magic square. But all sum is not same. Kindly correct me if I am wrong.
@VishnuKumar-fo2rl
@VishnuKumar-fo2rl Год назад
Thanks for your explanation first but this only works with odd n values, not for even values, can you make a video on that?
@JustMarkTheScot
@JustMarkTheScot 2 года назад
Very well explained, thank you!
@CamilaMartinez-vm4bj
@CamilaMartinez-vm4bj 3 года назад
This was so good, thank you
@niliba6194
@niliba6194 4 года назад
Thank you for the perfect explanation 🙏🏻
@cesarl.c.847
@cesarl.c.847 3 года назад
Hi... to review other video, also can you to download Excel file to resolve Square Magic 3x3 and 5x5. To Find on RU-vid as: Creación Cuadrado Mágico lado impar - Creating Magic Square odd side. Grettings.
@ravideshmukh33
@ravideshmukh33 3 года назад
Sir you are teaching simple things in hard manner
@77YuvrajSingh77
@77YuvrajSingh77 4 года назад
sir please do a video on algorithm of magic square of even order(eg 4,6,8,etc).
@sehajdhawan6619
@sehajdhawan6619 3 года назад
The magic matrix only exist for odd values of n.
@reelsofharshitha3742
@reelsofharshitha3742 3 года назад
is this algorithm works on 4x4, 5x5?
@ChanchalDass
@ChanchalDass Год назад
Can you give some examples of 4x4 and 5x5 algi=orithm. I think there is some problem in the given algorithm for 4x4 magic square.
@opethfloyd9429
@opethfloyd9429 4 года назад
This video was very helpful. Thank you so much.
@airineivlad6559
@airineivlad6559 3 года назад
God bless you my friend
@adarshgupta106
@adarshgupta106 3 года назад
Awesome explanation sir
@abdullahiabdislaan
@abdullahiabdislaan 2 года назад
Thanks bro, well expalined.....
@whitegalactico7152
@whitegalactico7152 4 года назад
Superb sir . U r a genius
@saruncse85
@saruncse85 4 года назад
Thank you Vivekanand for the explaination. How did you conclude these formula's?
@MegaCreep1234
@MegaCreep1234 4 года назад
nice job bro. It helps me a lot
@thayaparanselladurai3731
@thayaparanselladurai3731 6 лет назад
This technic doesn't support to even number order magic squares such as 4 X 4, 6 X 6 and etc. can you post for the even number order magic squares.
@buddhaeyes
@buddhaeyes 5 лет назад
yes this shit is not working.
@gorgenyilmaz8711
@gorgenyilmaz8711 4 года назад
@@buddhaeyes you could give some respect for his effort.
@Alexander-io5pl
@Alexander-io5pl 3 года назад
I guess for those even-degree cases, the four adjustment cases have some recursion relationship, for example when we violate the 4th case, then i++, j-=2, then we violate 1st, or 2nd case again. Perhaps we need to recursively check the violation until we get a full valid (i, j). Just a guess...
@narayananseshagirirao2569
@narayananseshagirirao2569 5 лет назад
Beautiful explanation. Thanks for the useful information
@himanshukhare9285
@himanshukhare9285 6 лет назад
It is not working for four dimensional matrix please suggest how to do it for 4 dimensional matrix
@BradenBest
@BradenBest 5 лет назад
surely you mean "magic square of order 4", not "4-dimensional matrix", which means something completely different. en.wikipedia.org/wiki/File:Double-even_magic_construction.png www.math.wichita.edu/~richardson/mathematics/magic%20squares/even-ordermagicsquares.html
@areebahmadsiddiqui2648
@areebahmadsiddiqui2648 5 лет назад
it is for only odd
@ramyaj3637
@ramyaj3637 4 года назад
Awesome explanation....
@radhakrishna4364
@radhakrishna4364 Год назад
Sir try it for 4x4 squares it is not working for 4x4 squares
@7736385759
@7736385759 2 года назад
I have felt this method very as a complicated one.
@tanjil.ahmmed
@tanjil.ahmmed 2 года назад
Loved the video
@ishitaarora439
@ishitaarora439 4 года назад
great explanation!thanks
@Atrainn234
@Atrainn234 Месяц назад
my question now is where did the formulas come from
@jimmywere473
@jimmywere473 5 лет назад
You are a great Teacher. Thank you. Please do a video on dijkstra's algorithm.
@____phenixx_____
@____phenixx_____ 3 года назад
Sir. Very very Tq for this one am not having any word to explain about my happiness tqtqqqq
@adnanalkarfan2277
@adnanalkarfan2277 3 года назад
If im using bfs or dfs can i consider every move a relative(the moves in this video) like (i,j) to (i-1)(j+1)
@sayantanray9595
@sayantanray9595 4 года назад
Nice explanation!!!
@aminhadidchi2817
@aminhadidchi2817 5 лет назад
thanks ,but this algorithm do not working with 4×4
@bruceonion
@bruceonion 4 года назад
Yes.
@bruceonion
@bruceonion 4 года назад
I also want to know why
@krushibensutariya5815
@krushibensutariya5815 Год назад
This is only for odd order, not an Even order
@sarahhakeam9896
@sarahhakeam9896 Год назад
that was great thank you
@pratyakshsaini2870
@pratyakshsaini2870 3 года назад
how do i come with with this from basic brute force solution?
@monikaparmar2061
@monikaparmar2061 4 года назад
Only works for the odd squares. Misleading Title.
@__DYNAX_Tech__
@__DYNAX_Tech__ 4 года назад
It will really helpful 👍
@SandhyaSingh-zb9sk
@SandhyaSingh-zb9sk 3 года назад
Nicely explained
@engrsyedadilsardar6047
@engrsyedadilsardar6047 5 лет назад
It is for finding the sum of 15 from all sides will u please tell me that how to make a magic square to get the sum of 45 or 47.
@esseandessence4421
@esseandessence4421 4 года назад
What is the theory behind it
@natesh1
@natesh1 6 лет назад
Nice one. Keep making videos like this....
@VeraDongmo-ql1lu
@VeraDongmo-ql1lu 5 месяцев назад
Very instructive🤔🤔
@shivamtyagi3554
@shivamtyagi3554 4 года назад
sir tell me the code if position is occupied...plz... i hope you give the answer shortly
@AjayKumar-ls8oi
@AjayKumar-ls8oi 3 года назад
4:30 how 3/2 is 1? 3/2 isn't 1.5?
@b-designer
@b-designer 3 года назад
division of integer
@AjayKumar-ls8oi
@AjayKumar-ls8oi 3 года назад
@@b-designer 👍yup..Thank you bro..
@b-designer
@b-designer 3 года назад
@@AjayKumar-ls8oi u'r welcm
@parulmogre2200
@parulmogre2200 4 года назад
very helpful.. Thank you
@menelik1020
@menelik1020 5 лет назад
Excelente... muchas gracias...
@jorawarsanghi1266
@jorawarsanghi1266 2 года назад
Who made these rules.
@hemanthkommaraju1888
@hemanthkommaraju1888 6 лет назад
good sir.will u please make a video on printing all subarray integers in an Array
@nsfuntus3698
@nsfuntus3698 3 года назад
this is awesome
@falconhomefalconhome3784
@falconhomefalconhome3784 5 лет назад
Well done I hope you will do more good video like this thanks.
@mordiabukarat3985
@mordiabukarat3985 6 лет назад
thank you sir.your teaching skills are amazing.can you please upload video of converting binary tree to sum tree only if values are greater for the relevant node ? recursivley ? it is very confuse . thank you
@selvamani9937
@selvamani9937 5 лет назад
This method not working 4*4
@rhytham5427
@rhytham5427 5 лет назад
Sir please post a video on how to check a magic square
@abhishekdeepu2003
@abhishekdeepu2003 4 года назад
Sir please make a video on how to construct a magic cube of order 3x3x3.
@amouzoukevo2054
@amouzoukevo2054 3 года назад
thank you for all
@mostafashams5280
@mostafashams5280 3 года назад
Thank you so much
@hunterofendermen367
@hunterofendermen367 2 года назад
So I'm curious how does "3 by 2 equal 1" 3 minus 2 is 1 but he has a division symbol and 3 divided by 2 is 1.5, not 1. Can someone help me understand this??
@yuvarajyv5772
@yuvarajyv5772 2 года назад
Bro we using integer key word that can take only real numbers so 0.5 is neglated
@ChanchalDass
@ChanchalDass Год назад
@@yuvarajyv5772 Can take only integers
@adityapaithon6499
@adityapaithon6499 6 лет назад
Nice tutorial. But Explain how you got those steps too
@abhishekAbhi-rk1li
@abhishekAbhi-rk1li 5 лет назад
Geeks for geeks but u can't understand by seeing it
@sajidpattakkal1338
@sajidpattakkal1338 4 года назад
Is the video of 4×4 matrix available? If so please send.
@vikashkumargupta4876
@vikashkumargupta4876 3 года назад
It's not possible to create a magic square of any number except prime. All the best👍🏻
@koketjosethobja1960
@koketjosethobja1960 3 года назад
Thanks a lot.
@_inspireverse___
@_inspireverse___ 4 года назад
Very nice sir
@geniusjamir9807
@geniusjamir9807 2 года назад
Thank you
@dhanalakshmisenthilkumar7991
@dhanalakshmisenthilkumar7991 5 лет назад
nice explanation
@rahulkumargupta1718
@rahulkumargupta1718 5 лет назад
sir, undoubtedly, algorithm explained by you is appreciabble. i am facing problem while costructiong a magic sq. of order 4........ as entry is becoming (2,-2).......what to do at this point ,,,,,,,,,
@rahulkumargupta1718
@rahulkumargupta1718 5 лет назад
and one more thingwhn i m matching with the available magic sq., the starting point itself is not correct
@ShivaShiva-gj1ib
@ShivaShiva-gj1ib 4 года назад
@@rahulkumargupta1718 there is no unique magick square
@ShivaShiva-gj1ib
@ShivaShiva-gj1ib 4 года назад
@@rahulkumargupta1718 and algorithm i is only for odd order matrix
@yaswanthvysyaraju5319
@yaswanthvysyaraju5319 6 лет назад
please explain the algorithm how u make these rules
@vitsils6621
@vitsils6621 6 лет назад
if we have a square 5x5 what is the position for 7 ? I've got (0;0) However 2 already has (0;0) That means 7 has (1;-2) ?
@prathameshchavan2812
@prathameshchavan2812 5 лет назад
Ok, so I have to pick upper right cell to write next number and if that cell is occupied then pick left cell instead to write next number. Nice.
@rocketmik65
@rocketmik65 2 года назад
HND A Class best class
@tanmaydeo4487
@tanmaydeo4487 4 года назад
Please make a video on Page Ranking Algorithm
@dhanalakshmisenthilkumar7991
@dhanalakshmisenthilkumar7991 5 лет назад
sir can u send the answer for square matrix -4,1,6,3,-1,-5,2,-3,2 for using these numbers
@komalashar6131
@komalashar6131 5 лет назад
Share 4 by 4 matrix
@gameelevator1579
@gameelevator1579 4 года назад
Best video
@srinidhiii
@srinidhiii 6 лет назад
thanks very much sir.please explain the code for rotation of matrix.
@johnclawed
@johnclawed 5 лет назад
This is the common method for odd squares, but it doesn't work for even squares.
@abdourashad7555
@abdourashad7555 3 года назад
Thanks v much
@scanadith
@scanadith 3 года назад
Great
@jonchakoyu
@jonchakoyu 5 лет назад
Magic square would have explained still better. And this is not the only method. There are more than ten programmable methods.
@yuvarajyv5772
@yuvarajyv5772 2 года назад
What is other method will you give please 🥺
@jobbinejoseph8398
@jobbinejoseph8398 4 года назад
This will not work if N is even !!
@saisrikar7987
@saisrikar7987 6 лет назад
sir please make more videos daily
@nitishghosh646
@nitishghosh646 4 года назад
Thank u sir
@dovlet_chopa
@dovlet_chopa 4 года назад
It is not work even numbers
@gunachanduappari8983
@gunachanduappari8983 5 лет назад
I want this code
@jahanzaibshahid07
@jahanzaibshahid07 6 лет назад
iska code kha hain
@JaiChavan
@JaiChavan 3 года назад
Thanks. Jai Hind.
Далее
Print Matrix Diagonally (Diagonal order)
13:22
Просмотров 110 тыс.
skibidi toilet multiverse 042
20:57
Просмотров 4,7 млн
Немного заблудился 😂
00:16
Просмотров 250 тыс.
2. Elimination with Matrices.
47:42
Просмотров 2,6 млн
Leader in an Array (Code / Algorithm)
15:24
Просмотров 21 тыс.
The MAGIC Square Problem (Coding Interview Question)
7:24
Magic Squares by Brian Hadley
53:31
Просмотров 115 тыс.
How to make a Birthday Magic Square
7:35
Просмотров 32 тыс.
The Magical Disappearing Square
5:17
Просмотров 26 млн
Subset Sum Problem Dynamic programming
28:54
Просмотров 66 тыс.
skibidi toilet multiverse 042
20:57
Просмотров 4,7 млн