Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

HW 10: FINAL PRACTICE

Nastily Exhausting Wizarding Tests - NEWTs – 7th Year Exams at Hogwarts

Course: CS 5002

Spring 2023

Due: April 15, 2023

PROBLEMS

Problem 1: Dungeons & Dragons

Your character is being tormented by a mathematician DM who asks you to calculate some probabilties before rolling. Show your work.

(a) (2 points) Your party meets a Merchant in Baldur’s Gate who offers to sell you an artifact which he claims to be

a piece of the Rod of Seven Parts for only 500 gold. You know that a piece of the Rod of Seven Parts is worth at  least 10,000 gold but that the odds of this being the real thing are a million to one. If you were to buy the         “artifact”, what would its expected value be after purchasing?

(b) (2 points) You are unsure if this is the genuine article, so you decide to perform an Insight check on the

Merchant. Your DM allows you to roll with your +2 Wisdom modifier and your target is 17. With a modifier, it means that after your 20-sided die roll you add your modifier to the results. What is the probability that you  succeed in your Insight check by hitting or exceeding the target with one roll?

(c) (4 points) After passing the Insight check revealing the item to be a fake, the“Merchant”tries to flee but not      before throwing three“artifacts”in your direction. If any of them hit you, the“Merchant”will successfully         escape. Each dodge will require you to roll for an Acrobatics check for which you have a +3 modifier and the       dodging gets harder each time. The first has a target of 6, the second has a target of 11, and the third target is 19. What are the odds that you successfully pass all three Acrobatics checks and catch the“Merchant”?

(d) (4 points) What would the odds have been if you were injured and had a -1 modifier, meaning that you subtract one from the result of the roll?

Problem 2: Amazin

The giant online retailer Amazin, has data on the browsing behavior of its customers, such as the number of products viewed, the duration of browsing sessions, and the type of products viewed (e.g., electronics, clothing, home goods).  The store wants to use Bayes’rule to estimate the probability of a customer making a purchase based on their          browsing behavior.

Amazin has historical data that includes information on whether or not customers who exhibited similar browsing behavior in the past actually made a purchase. For example, based on the data, it is observed that out of 1000        customers who viewed products in the electronics category, 400 made a purchase, and out of 500 customers who    spent a long time (more than 10 minutes) on the website, 250 made a purchase. Additionally, the overall conversion rate, which is the percentage of visitors who make a purchase out of the total number of visitors to the website, is

estimated to be 5%.

Now, the store encounters a new shopper who has been browsing the website for a while, viewed multiple products in the electronics category, and has spent a significant amount of time on the website. Amazin wants you to calculate    the probability that this customer will make a purchase given their browsing behavior. Show your work.

Problem 3: ChatGPT

The following is the result of asking ChatGPT to “Explain the monty hall problem.”

The Monty Hall problem is a probability puzzle that is based on a hypothetical game show scenario. The problem is named after Monty Hall, who was the host of the popular television game show“Let’s Make a Deal.”

The scenario is as follows:

1. The game show contestant is presented with three doors, behind one of which is a car, and behind the other two are goats.

2. The contestant chooses one door without knowing what is behind it, and this door remains closed.

3. The host, Monty Hall, who knows what is behind each door, then opens one of the other two doors to reveal a goat.

4. The contestant is then given the option to either stick with their original choice or switch to the other remaining door.

5.  Finally, the contestant makes their decision by either sticking with their initial choice or switching to the other door, and the chosen door is opened to reveal what is behind it.

6. The question is: Should the contestant stick with their original choice or switch to the other door to maximize their chances of winning the car?

The counterintuitive and surprising answer is that the contestant should always switch doors to increase their        chances of winning the car. This is because when the contestant initially chooses a door, there is a 1/3 chance of     choosing the car and a 2/3 chance of choosing a goat. When Monty Hall, the host, opens one of the other doors to  reveal a goat, he is providing additional information to the contestant. By switching doors, the contestant takes      advantage of this additional information and increases their chances of winning the car from 1/3 to 2/3. This can be counterintuitive because it goes against our intuition that once a door is revealed to have a goat, the remaining two doors should have an equal chance of hiding the car, but in fact, switching doors gives the contestant a higher        probability of winning the car.

(5 points) Rewrite and simplify their explaination so that it sounds like a human wrote it.

Problem 4: Properites of relations

Let R be the relation on the set of integers, formally defined as: for all x,y ∈ Z,x R y  ⇐⇒ x > y. Please show your work to determine whether or not the given relation is:

(a) (2 points)  Reflexive:

(b) (2 points) Symmetric:

(c) (2 points) Transitive:

Problem 5: Domain, codomain and range

Please find the domain, codomain, and range of each of these functions.

(a) (3 points) The function that takes a number and assigns the absolute value of that number.

(b) (3 points) The function that takes a string of characters and assigns the length of the string.

(c) (3 points) The function that takes a color name string and assigns its 24-bit RGB value.

Problem 6: O-Bijection!

Determine the function’s domain, codomain, and range and then evaluate whether or not the function is a bijection (one-to-one and onto) and show your work (consider graphing):

(a) (4 points) f(x) = x + sin(x)

(b) (4 points) f(x) = log(x)

(c) (4 points) f(x) = x2 − x − 1

Problem 7: One by one

Show your work to calculate the terms a0 , a1 , a2 , and a3 of the sequence {an }, where {an } equals to: (a) (2 points)  (−n)n

(b) (2 points)  

Problem 8: Sequences and Word Problems

Please list the first 10 terms of each of these sequences.

(a) (2 points) The sequence that begins with 1, and in which each successive is its index multiplied by the previous term.

(b) (2 points) The sequence that lists all of the numbers which are only divisible by themselves and the number 1

starting from the number 2.

Problem 9: Sum-thing is happening

Calculate the following sums and show your work.

(a) (5 points) i(3)=0 j(2)=0 (3i + 2j)

(b) (5 points) i(3)=1 j(3)=0 2 × (i × j)

Problem 10: Induction Zone

Using Mathematical Induction, prove the following identity.

n

(k 1)k = (n3 n)/3

k=1

Problem 11: Shortest Path

Given the following graph, calculate the smallest cost path from vertex A to vertex G utilizing Dijkstra’s Algorithm, showing all steps. 

Problem 12: Tabletop

Consider the following graph: 

(a) (4 points)  Find a path from Manila to Atlanta using DFS, making decisions alphabetically. Show your work.

(b) (4 points)  Find a path from Manila to Atlanta using BFS, making decisions alphabetically. Show your work.

Problem 13: Order of Growth

Rank these functions in terms of order of growth. That is, find an arrangement of functions g1 ,g2 , . . . gn such that g1  = O(g2 ),g2  = O(g3 ), . . ..

When multiple functions have the same order, please indicate so.

1. lg(lg n)

2. n3

3. n!

4.  (  )n

5. 2lg n

6.  (n + 1)!

7. ln n

8. nlg n

9. 22n

10. n2 + log n

Problem 14: Mystery Algorithm

Consider the following algorithm, represented in pseudocode.

compute(n)

1   x = 0

2   y = 1

3   for i = 1 to n

4          x = y

5          y = y + i

6   return x + y

(a) (2 points)  Describe what the algorithm is doing in “natural language”.

(b) (3 points) What is the runtime of this algorithm? Use Big-O notation. Explain your answer.

Problem 15: Binary Search Algorithm

Consider the sorted list of words, given below. The sorted list is used as an input to a Binary Search algorithm.

1.  PUREE

14.

SALAD

27.

TASKS

40. VOUGE

2.  PURGE

15.

SALES

28.

TAUNT

41. VOWEL

3.  PURSE

16.

SALON

29.

TAXED

42. WACKO

4.  PUTTY

17.

SALSA

30.

TORTA

43. WANNA

5. QUACK

18.

SCUBA

31.

TORTS

44. WANTS

6. QUAKE

19.

SEAME

32.

TORUS

45. WAVED

7. QUART

20.

SEARS

33.

TOTAL

46. WAVES

8.  RELAX

21.

SEATS

34.

TOUGH

47. WAVEY

9.  RELAY

22.

SEDAN

35.

TRAIL

48. WEARY

10.  REMEN

23.

TANGO

36.

TRAIN

49. WEEPY

11.  REMIX

24.

TAPIR

37.

TROAT

50. WHEAL

12.  REPLY

25.

TARDY

38.

TROUT

 

13.  RESTY

26.

TASER

39.

TRUCK

 

(a) (3 points)  How many times is Binary Search called to find the word TANGO? Indicate which elements are looked at in order. (for example, does the algorithm look at element 1, then 2, then 3, . . . ?

SUBMISSION DETAILS

Submit your answers to these problems on Gradescope as a pdf. You can do this by printing out this assignment,

hand-writing your answers, and then scanning in, or by using programs like Preview on the Mac or Adobe Acrobat or Edge on Windows to annotate the pdf. Or you can print and write on the assignment then submit using the Gradescope app.