Write pseudocode for a procedure random-search

Assignment Help Data Structure & Algorithms
Reference no: EM13920349

1. Sort the following functions by increasing order of complexity; if applicable, you need to prove stronger results that involve "small-o" or "small-ω" notations. Also, show your work with detailed explanation, just writing the order will not provide you any credit.

n!, 2n, nlgn, n Ig n, n√n

2. Prove the followings:               

a) k=2Σn-1 k lg k ≤ ½ n2lgn - n2/4

b) k=0Σn(nk)2 = (2nn)

3. Prove that in the array Pin procedure PERMUTE-BY-SORTING, the probability that all elements are unique is at least 1 - 1/n. (hint: we are not looking for the exact probability, rather we are looking for a lower bound, so you can simplify your probability expression by choosing a suitable lower bound, the inequality (1 - x)n ≥ 1- nx can be useful)

4. Consider the following randomized algorithm for searching for a value x in an unsorted array A consisting of n elements; pick a random index i into A; if A[i] = x, then we terminate; otherwise, we continue the search by picking a new random index into A. This process continues until we find an index j such that A[j] = x or until we have checked every element of A. Note that, we pick from the whole set of indices each time, so that we may examine a given element more than one. Now, answer the following questions:

a) Write pseudocode for a procedure RANDOM-SEARCH to implement the strategy above.

b) Suppose that there is exactly one index i such that A[i] = x. What is the expected number of indices into A that we must pick before we find x and RANDOM-SEARCH terminates?

c) Generalize your solution for the above part, for the cases when there are k ≥ 1 indices i such that A[i] = x.

d) Now, find the expected number of indices into A that we pick for the case when there are no indices such that A[i]= x.               

5. For the following recurrences, find a good asymptotic upper bound using recursion tree method

a) T(n) = 4T(n/2) + n

b) T(n) = 2T(n/2) + n lg n

6. For the following recurrences, find a good asymptotic upper bound using Master method (if applies) and substitution method

a) T(n) = 4T(n/2) + n2√n

b) T(n) = 4T(n/3) + n lg n

c) T(n) = 2T(n/2) + n lg n

d) T(n) = 2T(n/4) +√n

7: Proof the correctness of BubbleSort. For an array of size ri, what is the expected number of exchanges the BubbleSort algorithm performs considering a uniform random permutation.

Reference no: EM13920349

Questions Cloud

Determine variances in operations, quality improvement : Benchmarking is the comparison of one's organization to another to determine variances in operations, quality improvement, and financial measurement. As a manager, how would we obtain such information from a competitor?
Shared responsibility for departmental success : Furthermore, such working relationship should be constructed on a solid foundation of trust, common grounds, and with a shared responsibility for departmental success.
Cost of the merchandise sold : Paid rent for May, $5,000. Purchased merchandise on account from Martin Co., terms 2/10, n/30, FOB shipping point, $36,000. Paid freight on purchase of May 3, $600. Sold merchandise on account to Karman Co., terms 2/10, n/30, FOB shipping point, $68,..
Analyse financial and strategic plans for small business : Explain and suggest solutions to the kinds of problems encountered by small and medium entrepreneurial businesses and analyse and solve various business problems using case study approaches found in academic literature
Write pseudocode for a procedure random-search : Write pseudocode for a procedure RANDOM-SEARCH to implement the strategy above. Suppose that there is exactly one index i such that A[i] = x. What is the expected number of indices into A that we must pick before we find x and RANDOM-SEARCH termina..
Planning involves which of the following : 1) Planning involves which of the following? 2) _______ is specifying the goals to be achieved and deciding in advance the appropriate actions needed to achieve those goals.
Global commerce and web development company : This case study reviews ExtremeNet, which is a global -commerce and web development Company, and the questions surrounding employee versus company's rights.
Honor killings simply domestic violence : After reading the articles, Are honor killings simply domestic violence? and ‘Honour' crimes are domestic abuse, plain and simple, please respond to each of the following questions:
Calculate the labour total variance and labour rate variance : Calculate the following variances. The labour total variance, The labour rate variance, The idle time variance and The labour efficiency variance

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