Describe an efficient algorithm that can use rustbucket

Assignment Help Data Structure & Algorithms
Reference no: EM132951753

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.

Note: Need Only Question 1 and Question 3.

Reference no: EM132951753

Questions Cloud

How do see financial reporting requirements for companies : How do you see the financial reporting requirements for companies shifting in 10 to 20 years? Are they going to become more stringent or more relaxed?
What is the ratio of real assets to total assets : Note promising to pay back the loan over 5 years. Prepare its balance sheet just after it gets the bank loan. What is the ratio of real assets to total assets?
What is the operating cash flow for the project in year two : The tax rate is 34 percent and the required return on the project is 10 percent. What is the operating cash flow for the project in year 2
What advice would give to natasha : Calculate the present value of the salary differential for completing the certification program. Subtract the cost of the program to get the NPV
Describe an efficient algorithm that can use rustbucket : Describe an efficient algorithm that can use Rustbucket to sort n music files correctly and show that your algorithm has expected running time
Determine the degree of operating leverage : Poseidon Swim has average fixed costs per year of $8,203. Determine the degree of operating leverage for the level of production and sales 464 swim trunks
Calculate the mirr for your client investment opportunity : Your client is using the modified internal rate of return. Calculate the MIRR for your client investment opportunity. The expected return on this investment.
Prepare balance sheet just after gets the bank loan : CSUG Products is a start-up computer software, Prepare its balance sheet just after it gets the bank loan. What is the ratio of real assets to total assets?
Calculate the amount of gift tax due : In 2010 Casey made a taxable gift of $5 million to both Stephanie and Linda (a total of $10 million in taxable gifts). Calculate the amount of gift tax due

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd