unit 8: algorithms – assignment       total points for

Category: Mathematics

 

Unit 8: Algorithms – Assignment

 

 

 

Total points for Assignment:  35 points.  Assignments must be submitted as a Microsoft Word document and uploaded to the Dropbox for Unit 8.   All Assignments are due by Tuesday at 11:59 PM ET of the assigned Unit.

 

NOTE: Assignment problems should not be posted to the Discussion threads. Questions on the Assignment problems should be addressed to the instructor by sending an email or by attending office hours.

 

You must show your work on all problems.  If a problem is worth 2 points and you only show the answer, then you will receive only 1 point credit.   If you use a calculator or online website, give the source and tell me exactly what you provided as input.   For example, if you used Excel to compute 16 * 16, state “I typed =16*16 into Excel and got 256.   You may type your answer right into this document. 

 


Part I.   Basic Computations

 

1.         (8 points) Consider the following pseudo code for determining any sum in this form:
ComputeSum:
INPUT m
sum = 0
for k = 6 to m do
     sum = sum + 5*k^2 + 2*k -10
next k
OUTPUT sum

 

a.  Are the inputs and outputs for this algorithm well defined?  Explain.

 

b.  Identify an iterative operation in this algorithm.

 

2.  ( 7 points)  Consider this algorithm used to sort an array in this form:

 

 

 

 

S(n) =

 

 

 

BUBBLESORT:
INPUT S, n    (an array called S, with n elements)
FOR i = 1 to n – 1
     FOR j = 1 to n – 1
          if S(j) > S(J+1) then
              exchange the contents of S(j) with S(j+1)
     NEXT
NEXT
OUTPUT S

 

Using the following grid, show a trace for this algorithm using the following values:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Part II.  Case Study                    Season Finale:  Unlocking the Treasure

 

 

The directors and producers of the “Patty Madeye Mysteries”  have decided that the season finale for the show will be filmed in a secret location.  They have identifed a remote island and visited it to determine what facilities and features are available on the island.  The interns that were sent to scout out the island only had time to draw this map of the island and collect some other information.

 

 

 



 

In order to open the lock to the treasure chest, you will need to solve a puzzle using discrete math.    Shown below are the paths and distances that connect the 7 locations on the map.

 

From

To

Distance
(in meters)

C

D

80

D

E

25

E

G

80

D

G

80

D

A

100

A

F

80

A

G

80

B

A

25

C

B

25

C

E

100

B

E

100

G

F

25

B

F

80

A

C

80

 

 

 

 

Clue #1:   (3 points)  One of the things that the film crew will need to know about is the condition of light during the day at the island.  The only marking on the island was this binary representation of the longitude.  Convert this longitude to decimal so that the crew can estimate time of sunrise and sunset.   Show your work.

 

 

 

Longitude:

 

 

 

Answer: 148   I entered =Bin2Dec(10010100)  into excel

 

 

 

Clue #2.  (3 points)  The cast and crew will be staying in the 8 tents shown in the Tent Village.  Two of the tents will be set aside for to be used for “Hair and Makeup” (one for the males, one for the females).  How many different ways can you select these special tents out of the 8 available?

 

 

 

Answer: 28 different ways I entered =COMBIN(8,2) and got the answer

 

 

 

Clue #3.  (3 points)   Since the natives on this remote island only speak Spanish, it is important to know how many people in the cast & crew of 56 people.   The producers have provided the following information and asked you to prepare a Venn Diagram depicting the various sets and subsets of this group. 

 

 

 

F = {members of the film crew}

 

S = {members of the cast & crew who speak Spanish}

 

M = {male members of the cast & crew}

 

 

 

n(F) = 10

 

n(S) = 14

 

n(M) = 15

 

n(F  and S) = 4

 

n(F  and M) = 5

 

n(M and S and F) = 3

 

n(M or S or F) = 28

 

 

 

How many members of the cast & crew are male and speak Spanish, but are NOT on the Film Crew?

 

Answer: 7

 

                                                  S

 

               F

 

 

 

 
 

 

                                                       3                                     17

 

                                       1

 

                           4                          

 

 

 

                                      3

 

 

 

                                2            7

 

 

 

 

 

 

 

                                       2

 

 

 

 

 

 

 

                                          M

Clue #4.   (3 points)   A strange children’s game was found on the island with the following markings: 

 

 

 

 


Determine the 20th element of the sequence using the general term for the sequence.

 

 

 

Answer 110

 

 

 

 

 

Clue #5.  (3 points)   This clue requires solving a logic problem:

 

 

 

p:         cast member is male

 

q:         cast member speaks Spanish

 

r:          cast member has short hair

 

s:          it is NOT raining

 

 

 

If a cast member is male and has short hair, does not speak Spanish, and it is raining, determine the truth value for the following expression:

 

 

 

 

Answer:          

 

Clue #6.  (3 points)   To solve this clue, you must determine if there exists an Euler path or Euler circuit between the 7 locations on the island.  If so, describe it.  If not, explain how you know that such a path or circuit does not exist.

 

 

 

Answer:          

 

 

Clue #7.  (2 points)   Determine a Minimum Spanning Tree for the graph described by the paths on the island, using the distances between the locations as weights. 

 

 

 

What is the weight of the resulting spanning tree?

 

 

 

Answer: 

Record your clues here, then use the following algorithm to determine the 7 digit combination to unlock the treasure.

 

Clue #1:
Longitude expressed in decimal:

Clue #2:

Number of combinations:

Clue #3:
n(M + S +~F)

 

Clue #4:


Clue #5:

Truth Value

Clue #6:
Path, Circuit, or None?

Clue #7:
Weight of spanning tree:

 

 

 

 

 

DIGIT1

DIGIT2

 

DIGIT3

DIGIT4

DIGIT5

 

 

 

 

 

 

 

 

 
  Horizontal Scroll: To unlock the treasure,  you must determine the combination for the lock:    DIGIT1 = 2  FOR i = 1 to Clue#3   DIGIT1 = DIGIT1 + 2  NEXT    DIGIT2 = (Clue#1 / 4) – Clue#2    IF Clue#4 = 71  THEN DIGIT3 = 4  ELSE DIGIT3 = 7    IF Clue#5 = True AND Clue #7 < 275  THEN DIGIT4 = 2  ELSE DIGIT4 = 1    IF Path exists in Clue #6  THEN DIGIT5 = 0  ELSE       IF Circuit exists in Clue #6      THEN DIGIT5 = 2      ELSE DIGIT5 = 8

 

 

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00