CSC 226 Algorithms And Data Structures Assignment

Assignment Help Data Structure & Algorithms
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.

Reference no: EM132951740

Questions Cloud

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

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