Reference no: EM132951740
CSC 226 Algorithms And Data Structures - University of Victoria
Question 1. Write an in-place version of the linear selection algorithm, using subarrays of size 7 for the median of medians selection. Use the linearSelect(S,k) algorithm in slides 4 and 5 of lecture 18 and the inPlaceQuickSort(S,a,b) algorithm in the Goodrich and Tamassia textbook (page 255) as your guideline for writing this algorithm. The algorithm should have the following heading,
Algorithm inPlaceLinearSelect(S,a,b,k)
Input: An array, S, of distinct elements; integers a and b with a ≤ b; and integer k ∈ [a + 1, b + 1]
Output: The kth smallest element of S
Question 2. Consider the experiment of tossing a fair coin four times,
a. What is sample space associated with this experiment? Label a heads h and a tails T.
b. Let ?? be the event that heads are flipped first. What is Pr(A)?
c. Let B be the event that exactly two heads and two tails are flipped (in any order). What is Pr(B)?
d. Let ?? and B be as defined above, what is Pr(A ∩ B)?
e. Let X be the number of heads flipped. What is the expected value of X?
Question 3. Suppose you would like to sort n music files using a comparison-based sorting algorithm (i.e. no bucket sort), but you only have an old, unreliable computer, which you have nicknamed "Rustbucket". Every time Rustbucket compares two music files, x and y, there is an independent 50- 50 chance that it has an internal disk fault and returns the value -1, instead of the correct result of 1 for true or 0 for false, to the question, "x ≤ y?" Otherwise, Rustbucket correctly performs every other kind of operation (including comparisons not involving music files.) Describe an efficient algorithm that can use Rustbucket to sort n music files correctly and show that your algorithm has expected running time that is O(n log n).
Question 4. Draw the 11-item hash table resulting from hashing the keys 12, 44, 13, 88, 23 94, 11, 39, 20, 16, and 5, using hash function h(k) = (2k + 5) mod 11, assuming collisions are handled by each of the following:
a. Separate chaining.
b. Linear probing.
c. Quadratic probing.
d. Double hashing using the secondary hash function h′(k) = 7 - (k mod 7).
Question 5. Give a pseudocode description for performing insertion, searching, removal from a hash table that uses quadratic probing to resolve collisions where we use a special marker to represent deleted elements. You may use the pseudocode given on page 201 of the Goodrich and Tamassia book (attached to this assignment) as a template for your pseudocode. Note, you will not use the Shift(i) method.
Prepare the income statement in order to know operational
: Prepare the income statement in order to know the operational efficiency of the company. The company "La Chiapaneca, S.A." closed the month
|
Calculate calipso weighted average cost of capital
: Calipso is making annual interest payments equal to $400,000. Assuming calipso faces a 17% tax rate, calculate calipso's weighted average cost of capital
|
What steps can be taken to improve the stock positions
: Please elaborate on this issue. What steps can be taken to improve the stock positions of the travel industry and ensure safe travels
|
What amount does target report for net property
: Target Corporation prepares its financial, What amount ($ in millions) does Target report for net property and equipment for the year ended February 3, 2018?
|
CSC 226 Algorithms And Data Structures Assignment
: CSC 226 Algorithms And Data Structures Assignment Help and Solution, University of Victoria - Assessment Writing Service
|
What will the balance in the allowance for doubtful accounts
: If the company estimates that 8% of its outstanding receivables will be uncollectible, what will be the balance in the allowance for doubtful accounts
|
Which is more relevant on book values or make values
: Which is more relevant, the debt-equity ratio based on book values or make values? Why? What is the debt-equity ratio based on book values?
|
What is the price of the bonds today
: If the bonds are noncallable, what is the price of the bonds today? Assets, Inc., plans to issue $5 million of bonds with a coupon rate of 7 percent.
|
What the Carrying value of the lease liability
: The lease payment is P100,000 payable at the end of each year. What the Carrying value of the lease liability as of 12/31/12
|