1) Repeat the sorting methods
2) Discuss random vs. pseudo-random generators
3) Exercise for today is to write the pseudocode and C program for constructing magic squares.
The magic square is n x n square grid (where n is the number of cells on each side) filled
with distinct positive integers in the range 1 , 2 , . . . , n^2 such that each cell contains
a different integer and the sum of the integers in each row, column and diagonal is equal.
The sum is called the magic constant or magic sum of the magic square and can be calculated:
M = n(n^2+1)/2
A square grid with n cells on each side is said to have order n.
Read:
https://en.wikipedia.org/wiki/Magic_square
Ex 1: Go to paragraph "4.2 Method for constructing a magic square of odd order" and implement it.
Ex 2: Go to paragraph "4.3 A method of constructing a magic square of doubly even order" and implement it.
http://www.1728.org/magicsq2.htm
Homework:
Send the pdf file containg the pseudocode and C implementation of Ex 1 and Ex 2 to lukaskoz@mimuw.edu.pl
Additionally, the pdf file should contain at least two examples of magic squares for n=5, n=7 and n=4 and n=8.
Deadline: 29.10.2018 11:00 (CEST)