Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

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

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Nächste SlideShare
C mcq practice test 1
C mcq practice test 1
Wird geladen in …3
×

Hier ansehen

1 von 1 Anzeige

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

Herunterladen, um offline zu lesen

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     }
.

Anzeige
Anzeige

Weitere Verwandte Inhalte

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

Weitere von wviola (20)

Anzeige

Aktuellste (20)

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

  1. 1. 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 Â Â Â Â }

×