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

  Comparison of the applicability of array

Data structures include: 1. a linked list, 2. an ordered, one dimensional array, and three. a binary tree. Assume the list of letters R, A, N, B, C, F, X and G are stored in a list.

  What is z-buffer algorithm?

What is z-buffer algorithm?

  Can you find the element of an array

We would like to determine whether a given array A has a majority element, and if so, find the element.

  Find the mean number of rounds per contention period

Two CSMA/CD stations are each trying to transmit long documents. After each frame is sent, they contend for the channel using the binary exponential backoff algorithm.

  Find efficiency of high speed digital transmission system

Assume I have a multiplexer that is connected to a high speed digital transmission system that can transfer 1,536,000 data bits per second.

  Determine the order of insertions

Determine the order of insertions with this set of numbers that will result in a perfectly balanced BST(Binary Search Tree) and show the result of a preorder traversal of this tree.

  Design a algorithum

Design a algorithum

  Write a method that finds the average age of the students

Write a method that finds the average age of the students stored in the data structure and some Java code that could be used in a test program to display the value returned by the method on the console or command prompt.

  Write a pseudocode for divide-and-conquer algorithm

Write a pseudocode for divide-and-conquer algorithm for finding the values of both the largest and smallest elements in an array of n numbers

  Write a program that allows cindy to input the number

One metric ton is approximately 2205 pounds. Write a program that prompts the user to input the amount of rice, in pounds, in a bag. The program outputs the number of bags needed to store one metric ton of rice.

  Describe and implement fft algorithm cooley-tukey

Describe and implement in C++ FFT algorithm "Cooley-Tukey". Also, implement naive DFT and compare naive DFT with FFT using: a sample of the signal x(t) = t

  Linked list class to hold a series of integers

1) Design your own linked list class to hold a series of integers. The class should have member functions for appending, inserting, and deleting nodes. Dont forget to add a destructor that destroys the list. Demonstrate the class with a driver progra..

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