<< Prev Showing: 101-105 of 353 Next >>
· 76-80 · 81-85 · 86-90 · 91-95 · 96-100 · 101-105 · 106-110 · 111-115 · 116-120 · 121-125 · 126-130 ·Order-statistic tree (Augmenting Data Structures)
Need help to show how to use an order-statistic tree to count the number of inversions in an array of size n in time O(n lg n). Note that we call a pair (i,j) an inversion if i < j, but key[i] > key[j]. Thus, an increasing sequence has no inversions. A decreasing list has the maximum number of inversions, n(n-1)/2. I believe we start by letting k be the number of inversions in the sequence. We then create an order-statistic tree and store with each node the original index in the sequence. Is there anything else we store in the node and what would be the algorithm for the number of inversions?
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
71581
OTA ID:
102804
Select (Medians and Order statistics)
Please review problem and verify the solution. problem --------- In the algorithm SELECT, the input elements are divided into groups of 5. Will the algorithm work in linear time if they are divided into groups of 7? Argue that SELECT does not run in linear time if groups of 3 are used. solution --------- Use groups of k for the analysis. The worst case SELECT will be called recursively on at most n - (n/4 - k) = 3n/4 + k elements. The recurrence is T(n) <= T(ceiling(n/k)) + T(3n/4 + k) + O(n) Solve the recurrence by substitution I believe the solution is the following: T(n) <= T(ceiling(n/k)) + T(3n/4 + k) + O(n) <= c(n/k + 1) + 3cn/k + c(k+1) + O(n) <= c... click for more
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
71589
OTA ID:
102804
Binary Tree Tree worst case scenario
We know that binary trees are O(n) for these dictionary operations... What is the worst case input scenario for each operation (i.e. a list of numbers in reverse order...) Binary Tree ------------- Mininum - ? Maximum - ? Search - the tree is unbalanced (resembles a linked list) Successor - the tree has one node on left subtree and resembles a linked list on right subtree . Predecessor - ? Insert - insert a key that is greater than the max value of the tree Delete - remove an key that is the max value of the tree
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
71675
OTA ID:
102804
Division method for a hash function
Please review the problem and explain each step of the solution listed below, and give me an example of an application which this property would be undesirable in a hash function. problem ---------- Consider a version of the division method in which h(k) = k mod m, where m = (2^p) -1 and k is a character string interpreted in radix 2^p. Show that if a string x can be derived from string y by permuting its characters, then x and y hash to the same value. Give an example of an application in which this property would be undesirable in a hash function. solution --------- All permutations can be generated by a sequence of two character interchanges. If two arbitrary characters... click for more
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
71748
OTA ID:
102804
The number of strongly connected components in a graph G is k. By how much can this number change if we add a new edge?
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
72489
OTA ID:
102804
<< Prev Showing: 101-105 of 353 Next >>
· 1-5 · 6-10 · 11-15 · 16-20 · 21-25 · 26-30 · 31-35 · 36-40 · 41-45 · 46-50 · 51-55 · 56-60 · 61-65 · 66-70 · 71-75 · 76-80 · 81-85 · 86-90 · 91-95 · 96-100 · 101-105 · 106-110 · 111-115 · 116-120 · 121-125 · 126-130 · 131-135 · 136-140 · 141-145 · 146-150 · 151-155 · 156-160 · 161-165 · 166-170 · 171-175 · 176-180 · 181-185 · 186-190 · 191-195 · 196-200 · 201-205 · 206-210 · 211-215 · 216-220 · 221-225 · 226-230 · 231-235 · 236-240 · 241-245 · 246-250 · 251-255 · 256-260 · 261-265 · 266-270 · 271-275 · 276-280 · 281-285 · 286-290 · 291-295 · 296-300 · 301-305 · 306-310 · 311-315 · 316-320 · 321-325 · 326-330 · 331-335 · 336-340 · 341-345 · 346-350 · 351-353 ·Page generated in 0.095 seconds