Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 11, Problem 2P
(a)
Program Plan Intro
To determine the probability Qk of exactly k keys hash present in to a particular slot of the hash table having n number of slots and n keys.
(b)
Program Plan Intro
To show that the probability of slot contacting maximum keys is less then or equals to n times of probability of exactly k keys present in the particular slot.
(c)
Program Plan Intro
Show that the probability of a slot having maximum k keys Qk is less than
(d)
Program Plan Intro
Show that the probability Pkof a slot having maximum number of k keys is less than 1/n2, where is equals to total no. of slots.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Given a matrix of dimension m*n where each cell in the matrix can have values 0, 1 or 2 which has the following meaning: 0: Empty cell 1: Cells have fresh oranges 2: Cells have rotten oranges So we have to determine what is the minimum time required so that all the oranges become rotten. A rotten orange at index [i,j] can rot other fresh orange at indexes [i-1,j], [i+1,j], [i,j-1], [i,j+1] (up, down, left and right). If it is impossible to rot every orange then simply return -1.
Examples: Input: arr[][C] = { {2, 1, 0, 2, 1}, {1, 0, 1, 2, 1}, {1, 0, 0, 2, 1}};
Output: All oranges cannot be rotten. Below is algorithm. 1) Create an empty Q. 2) Find all rotten oranges and enqueue them to Q. Also enqueue a delimiter to indicate beginning of next time frame. 3) While Q is not empty do following 3.a) While delimiter in Q is not reached (i) Dequeue an orange from queue, rot all adjacent oranges. While rotting the adjacents, make sure that time frame is incremented only once. And time frame is…
Problem 2: In this problem we assume that h: U → {0, 1, . . . , m − 1} is a good hashfunction, that is, every key k has the same probability 1/m to map to any place in the tableT of length m.(i) What is the probability that three pairwise distinct elements u1, u2, u3 ∈ U aremapped by the function h to the same place in the table (that is, h(u1) = h(u2) =h(u3))?(ii) We insert three elements into an empty hash table T using the hash function h. Ifcollision is solved by chaining, what is the probability that T[0] and T[1] are empty?
Given an n×n matrix M in which every entry is either a 0 or 1. Present an algorithm that determines if ∃i, 1 ≤ i ≤ n, such that M[i, j] = 0 and M[j, i] = 1, ∀j, 1 ≤ j ≤ n ∧ j 6= i, using examining an entry of M as the key operation. Your algorithm must examine at most 3n − ⌊lg n⌋ − 3 entries of M.
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Problem 3: In this problem we assume that elements are drawn from a universal set U.(i) We insert n (different) elements into an empty hash table T of length m. If m = O(n),what is the time complexity of finding the minimal element in a T?(ii) Let |U| = m2 and suppose that collision is solved by chaining. Show that for everyhash function h: U → {0, 1, . . . , m − 1} there exists a sequence of m insertions intoan empty hash table T of length m giving rise a linked list of length m.arrow_forwardLet T(n) be defined by the T(n) = 4T(n/2) + 2n, T(1) = c Compute T(4) by iterating forwards and express your answer in terms of c. T(4) = divide-and-conquer recurrencearrow_forwardmatrix of dimension m*n where each cell in the matrix can have values 0, 1 or 2 which has the following meaning: 0: Empty cell 1: Cells have fresh oranges 2: Cells have rotten oranges So we have to determine what is the minimum time required so that all the oranges become rotten. A rotten orange at index [i,j] can rot other fresh orange at indexes [i-1,j], [i+1,j], [i,j-1], [i,j+1] (up, down, left and right). If it is impossible to rot every orange then simply return -1. Examples: Input: arr[][C] = { {2, 1, 0, 2, 1}, {1, 0, 1, 2, 1}, {1, 0, 0, 2, 1}}; Output: All oranges can become rotten in 2 time frames.Input: arr[][C] = { {2, 1, 0, 2, 1}, {0, 0, 1, 2, 1}, {1, 0, 0, 2, 1}}; Note: solve as soon as possible use c++ languagearrow_forward
- 11. Given is a sequence X of n keys k1, k2, ..., kin. For each key k; (1 < i< n), its position in sorted order differs from i by at most d. Present an O(n log d)-time sequential algorithm to sort X. Prove the correctness of your algorithm using the zero-one principle. Implement the same algorithm on a yn x Vn mesh. What is the resultant run time?arrow_forwardimplement the Local Beam Search algorithm to solve the n-queens problem. The following will be the outline of your implementation: Your program should start with k random initial states. At each step, generate all successors of the current k states and select the best k successors to move forward with. The successors will be chosen based on heuristic values (number of attacking pairs). If any of these k states has zero attacking pairs, the algorithm should stop and print the solution. If local minima are reached, the algorithm will stop and print the board configuration. Your program will print the final board configuration, the number of attacking pairs in the board, and the total time required to reach the final state. Note, in the n-queens problem, corresponds to a column, and the value at each index represents the row position of the queen in that column. each queen can only move vertically within its own column. The state of the board is…arrow_forwarde. If karrow_forwardLet A = {m ∈ Z | m ≡ 9 (mod 12)}. Let B = {n ∈ Z | n ≡ 1 (mod 4)}.arrow_forwardA hash table with ordered linear probing maintains an order amongkeys considered during the rehashing process. When the keys are encountered,say, in increasing order, the performance of a failed lookup approaches that ofa successful search. Describe how a key might be inserted into the orderedsequence of values that compete for the same initial table entry. ans in 30 min and give accuratearrow_forwardIn DL (discrete logarithm) based algorithms the private (secret) key is uniformly selected from the group Zq*. The public key is then computed from this private key. Is it feasible to do the opposite, i.e., select the public key uniformly from Zq* and compute the private key? Discuss.arrow_forward1. Let (01, 02, 03,..., 026!} be the set of permutations of the alphabet A = {A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z}, and consider the simple substitution cryptosystem with ok = A B C D E F G H I J K L M X MTAK ZQB NO LES N O P Q R S T U V W X Y Z IF G R V JH CY UDP W and key k. (a) Compute C = e(AUBUR NUNIV ERSIT YATMO NTGOM ERY, k). (b) Compute M = d(NIZFV SXHNF IHBKF VPXIA KIHVF GP, k).arrow_forwardLet n=pq, where p and q are distinct primes.arrow_forwardLet S be a planar subdivision with n edges. There exists a point location data structure for S that uses O(n) storage and has O(logn) query time in the worst case.arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education