Successfully reported this slideshow.

# Does anyone know how did we get answer for part (b)- Below is an inter.docx

Upcoming SlideShare
C mcq practice test 1
×

# Does anyone know how did we get answer for part (b)- Below is an inter.docx

Does anyone know how did we get answer for part (b)?
Below is an internal node in the backtracking tree for the 6 queens problem.
(a) Show the next solution that the program will discover.
(b) Use the above conguration to estimate the size of the backtracking tree (i.e., assume that the random experiment ended at the above left conguration).
ANSWER: Estimate = 1 + 6 + 6 * 3 + 6 * 3 * 1 + 6 * 3 * 1 * 1 + 6 * 3 * 1 * 1 = 97.
Another example is in page 9 http://www.csd.uwo.ca/~lila/anis.pdf
Solution
private void printGrid(){ 02 Â Â Â Â Â Â Â Â System.out.println(\"Count: \" + count); 03 Â Â Â Â Â Â Â Â for(boolean[] rows:grid){ 04 Â Â Â Â Â Â Â Â Â Â Â Â for(boolean b:rows){ 05 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â System.out.print((B)/> ? \"T\":\"F\"); 06 Â Â Â Â Â Â Â Â Â Â Â Â }Â Â Â Â Â Â Â Â Â Â Â  07 Â Â Â Â Â Â Â Â Â Â Â Â System.out.println(); 08 Â Â Â Â Â Â Â Â } 09 Â Â Â Â Â Â Â Â System.out.println(\"\ \"); 10 Â Â Â Â }
.

Does anyone know how did we get answer for part (b)?
Below is an internal node in the backtracking tree for the 6 queens problem.
(a) Show the next solution that the program will discover.
(b) Use the above conguration to estimate the size of the backtracking tree (i.e., assume that the random experiment ended at the above left conguration).
ANSWER: Estimate = 1 + 6 + 6 * 3 + 6 * 3 * 1 + 6 * 3 * 1 * 1 + 6 * 3 * 1 * 1 = 97.
Another example is in page 9 http://www.csd.uwo.ca/~lila/anis.pdf
Solution
private void printGrid(){ 02 Â Â Â Â Â Â Â Â System.out.println(\"Count: \" + count); 03 Â Â Â Â Â Â Â Â for(boolean[] rows:grid){ 04 Â Â Â Â Â Â Â Â Â Â Â Â for(boolean b:rows){ 05 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â System.out.print((B)/> ? \"T\":\"F\"); 06 Â Â Â Â Â Â Â Â Â Â Â Â }Â Â Â Â Â Â Â Â Â Â Â  07 Â Â Â Â Â Â Â Â Â Â Â Â System.out.println(); 08 Â Â Â Â Â Â Â Â } 09 Â Â Â Â Â Â Â Â System.out.println(\"\ \"); 10 Â Â Â Â }
.