SlideServe
Menu
Préférences
© SlideServe · v2026

Solved Problems

cira avatar
27 diapositives · 380 Views · Oct 09, 2014

Solved Problems. Problem 0.

Solved Problems - slide 1
01 / 27Solved Problems
1 / 17

Télécharger la présentation

Solved Problems
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Solved Problems

  2. Problem 0. We want to hire a new office assistant(OA) through an employment agency. The employment agency will send us one candidate each day. We will interview that person and then decide either hire that person or not. We must pay the employment agency a small fee to interview an applicant. To actually hire anapplicant more costly.We are committed to having, at all times, the best possible person for the job. Therefore , we decide that, after interviewing each applicant, if that applicant is better qualified than the current OA, we will fire the current OA and hire the new applicant. We are willingto pay the resulting price of this strategy but we wish to estimate what that price will be.

  3. Problem 0. • Write a pseudocode HIRE-ASSISTANT to expreess this strategy for hiring OA. Solution:

  4. Problem 0. b) When does the worst case occur? What is the total hiring cost? Solution: In the worst case we actually hire every candidate that we interview. This situation occurs if the candidates come in increasing order of quality, in which case we hire n times. The total hiring cost is where is the cost of interviewing a candidate and is the cost of hiring a candidate. Since is small as compared to

  5. Problem 0. c) What is the expected number of times that we hire a new OA? Solution: Let X be the random variable whose value equals the number of times we hire a new OA. Let be the indicator variable associated with the ith candidate hired.

  6. Problem 1. Exercise 2.3.7 p. 37 Describe a time algorithm that, given a set S of n integers and another integer x, determines whether or not there exist two elements in S whose sum is exactly x.

  7. Problem 1. Exercise 2.3.7 p. 37

  8. Problem 2. Exercise 4.1.6 p. 67 Show that the solution to is O(n log n). Solution:

  9. Problem 2a. Exercise 4.1.6 p. 67 Solve the recurrence by making a change of variables.

  10. Problem 2a. Exercise 4.1.6 p. 67

  11. Problem 2b. Exercise 4.1.6 p. 67 Solve the recurrence by making a change of variables. Solution:

  12. Problem 3. Polynomial Multiplication

  13. Problem 3. Polynomial Multiplication (cont.)

  14. Problem 3. Polynomial Multiplication (cont.)

  15. Problem 5. Analysis of d-ary heaps

  16. Problem 5. Analysis of d-ary heaps(cont.) • How would you represent a d-ary heap in an array? Solution:

  17. Problem 5. Analysis of d-ary heaps(cont.)

  18. Problem 5. Analysis of d-ary heaps(cont.)

  19. Problem 5. Analysis of d-ary heaps(cont.)

  20. Problem 5. Analysis of d-ary heaps(cont.)

  21. Problem 5. Analysis of d-ary heaps(cont.)

  22. Problem 5. Analysis of d-ary heaps(cont.)

  23. Problem 5. Analysis of d-ary heaps(cont.)

  24. Problem 6. Prob. 9.1 p.194

  25. Problem 7.

  26. Problem 7.

  27. Problem 6.