Difference between revisions of "CSC352 Homework 1"
Line 23: | Line 23: | ||
The version that was given to you in class launches ''N'' new threads, each one putting the first queen on Row 0, Column ''i'', with ''i'' ranging from 0 to ''N''-1. | The version that was given to you in class launches ''N'' new threads, each one putting the first queen on Row 0, Column ''i'', with ''i'' ranging from 0 to ''N''-1. | ||
− | Figure out a different approach, and | + | Figure out a different approach, run it, and compare it to the threaded ''N''-queens I gave you. |
In order to do so, you will have to measure the timing of your version and compare it to the timing of the class N-Queens for several values of ''N''. | In order to do so, you will have to measure the timing of your version and compare it to the timing of the class N-Queens for several values of ''N''. | ||
Line 30: | Line 30: | ||
* create a text file in the directory where you have your ''N''-queens problem. Call it '''timeIt.sh'' | * create a text file in the directory where you have your ''N''-queens problem. Call it '''timeIt.sh'' | ||
+ | |||
#! /bin/bash | #! /bin/bash | ||
for i in {10..20} | for i in {10..20} | ||
Line 39: | Line 40: | ||
* make the file executable | * make the file executable | ||
+ | |||
chmod +x timeIt.sh | chmod +x timeIt.sh | ||
* run the file | * run the file | ||
+ | |||
./timeIt.sh | ./timeIt.sh | ||
* observe the output | * observe the output | ||
+ | |||
----------------------------------- | ----------------------------------- | ||
10 | 10 | ||
Line 57: | Line 61: | ||
... | ... | ||
− | * Adapt this to your | + | * Adapt this to your needs so that you can plot the '''average''' of 3 runs of your version of the ''N''-queens to the '''average''' of 3 runs of the the class version of the ''N''-queens problem, for ''N'' ranging from 10 to 20. |
The answer to this problem should be a pdf containing 3 parts: | The answer to this problem should be a pdf containing 3 parts: | ||
Line 63: | Line 67: | ||
# the listing of your program's main class (not the whole program) | # the listing of your program's main class (not the whole program) | ||
# the plot of the execution time comparing your program to the class program. | # the plot of the execution time comparing your program to the class program. | ||
+ | |||
+ | submit hw1 part3.pdf | ||
</onlydft> | </onlydft> |