All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Study Help
New
Search
Search
Sign In
Register
study help
computer science
data structures algorithms
Questions and Answers of
Data Structures Algorithms
Suppose you have a software method, Conv, that can perform the convolution of two length-n integer vectors, A and B, using the FFT algorithm described in this chapter. Suppose further that you have
Describe a version of the FFT that works when n is a power of 3 by dividing the input vector into three subvectors, recursing on each one, and then merging the subproblem solutions. Derive a
In some numerical computing applications, a desired computation is to find a polynomial that goes through a given set of points on a line, which, without loss of generality, we can assume is the
Given degree-n polynomials p(x) and q(x), describe a method for multiplying the derivatives of p(x) and q(x), that is, p'(x)·q'(x), using O(n log n) arithmetic operations.
What is the bit-reversal permutation, reverse, for n = 16?
Prove that ω = 24b/m is a primitive mth root of unity when multiplication is taken modulo (22b + 1), for any integer b > 0 that is a multiple of m.
Write the complex nth roots of unity for n = 4 and n = 8 in the form a + bi.
Prove the following more general form of the reduction property of primitive roots of unity: For any integer c > 0, if ω is a primitive (cn)th root of unity, then ωc is a primitive nth root of
Describe the inverse FFT algorithm, which computes the inverse DFT in O(n log n) time. That is, show how to reverse the roles of a and y and change the assignments so that, for each output index, we
Construct a table showing an example of the RSA cryptosystem with parameters p = 17, q = 19, and e = 5. The table should have two rows, one for the plaintext M and the other for the ciphertext C. The
Why can’t you use the pair (1, n) as an RSA public key, even if n = pq, for two large primes, p and q?
Suppose the primes p and q used in the RSA cryptosystem, to define n = pq, are in the range [√n − log n, √n + log n]. Explain how you can efficiently factor n using this information.
Solve the previous exercise, but use the El Gamal cryptosystem instead of RSA.Data From Previous ExerciseSuppose Alice wants to send Bob a message, M, that is the price she is willing to pay for his
Suppose Alice wants to send Bob a message, M, that is the price she is willing to pay for his old bike. Here, M is just an integer in binary. She uses the RSA algorithm to encrypt M, to produce the
Write a nonrecursive version of Algorithm ExtendedEuclidGCD.
One of the main uses for public-key cryptography is that it can be used to establish a secret key for a communication session between Alice and Bob even if they have never met to share that secret
Show how to modify Algorithm ExtendedEuclidGCD to compute the multiplicative inverse of an element in Zn using arithmetic operations on operands with at most 2[log2 n] bits.
Show the execution of method FastExponentiation(5, 12, 13) by constructing a table similar to Table 24.6. Table 24.6. 1|0 8 21 12 6 3 1 1 12
Digital certificates are signed documents, where a respected authority verifies the binding between a person’s identity information (like their name, email address, etc.) and their public key. But
Construct the multiplication table of the elements of Z11, where the element in row i and column j (0 ≤ i, j ≤ 10) is given by i · j mod 11.
Suppose Alice is a U.S. spy on a 7-day trip to a faraway land and wants to prove for each day she is gone that she not been captured. She has chosen a secret random number, x, which she is keeping
Let p be a prime. Give an efficient alternative algorithm for computing the multiplicative inverse of an element of Zp that is not based on the extended Euclid’s algorithm. What is the running time
Consider the time stamping problem from the previous exercise, but now suppose that each day that there is one document added to the set, and one document that is removed from the set, but all of the
Write a nonrecursive version of Algorithm EuclidGCD.
There are instances when it is useful to prove that a document, D, exists on a certain date. In order to facilitate such proofs, Bob collects a group of documents, D1, D2,...,Dn, every day from
There is a perfectly secure cipher, known as the one-time pad, which is said to have been used for encrypting messages on the “hot line” between Moscow and Washington, DC, during the Cold War. In
Describe a generalized version of the Karp-Rabin lexicon matching algorithm for the case when their are k different possible pattern sizes. Characterize the running time of this algorithm in terms of
Give an example of an input instance for lexicon matching problem, with just a single pattern in the lexicon, L, that forces the Karp-Rabin algorithm given in Algorithm 23.11 to run in Ω(nm) time.
Show how to perform prefix matching queries using a suffix trie.
Suppose the trustee for the estate of famous photographer, Ansel Adams, was interested in finding examples of people posting Ansel Adams photographs on their personal websites without including
Suppose Bill is graduate of Slacker University, and he took a little “shortcut” when he was asked to build a software system that could take a pattern, P, of length, m, and text, T, of length, n,
Assuming that the characters in alphabet Σ can be enumerated and can index arrays, give an O(m + |Σ|) time method for constructing the last function from an m-length pattern string P.
Linguists are interested in studying the way in which words are constructed, with common prefixes and suffixes giving important clues to the meanings of words they are contained in. Thus, a useful
DNA strings are sometimes spliced into other DNA strings as a product of recombinant DNA processes. But DNA strings can be read in what would be either the forward or backward direction for a
Show how to modify the KMP string pattern matching algorithm so as to find every occurrence of a pattern string P that appears as a substring in T, while still running in O(n + m) time. (Be sure to
When a web crawler is exploring the Internet looking for content to index for a search engine, the crawler needs some way of detecting when it is visiting a copy of a website it has encountered
Describe an O(n log n)-time algorithm for finding the second closest pair of points in a set, S, of n points in the plane. That is, you should return the pair, (p, q), in S, such that the only pair
Suppose we are given an array, A, of n nonintersecting segments, s1, s2,...,sn, with endpoints on the lines y = 0 and y = 1, and ordered from left to right. Given a point q with 0 < y(q) < 1,
Suppose you are given a set S of n line segments in the plane, such that each makes a positive angle with the x-axis of either 30◦ or 60◦ (so there are only two possible slopes for the lines in
Let P be a set of n points in the plane. Modify the Graham scan algorithm to compute, for every point p of P that is not a vertex of the convex hull, either a triangle with vertices in P, or a
Given a set S of points in the plane, define the Delaunay triangulation of S to be the set of all triangles (p, q, r) such that p, q, and r are in S and the circle defined to have these points on its
Design an O(n2)-time algorithm for testing whether a polygon with n vertices is simple. Assume that the polygon is given by the list of its vertices.
Given a set P of n points, design an efficient algorithm for constructing a simple polygon whose vertices are the points of P.
Imagine a game, Battlestrip, which involves one player laying down a set of horizontal line segments on his computer screen, and another player laying down a set of vertical segments on hers. Then
Let C be a collection of n horizontal and vertical line segments. Describe an O(n log n)-time algorithm for determining whether the segments in C form a simple polygon.
In machine learning applications, we often have some kind of condition defined over a set, S, of n points, which we would like to characterize—that is, “learn”— using some simple rule. For
Say that a polygon, P, is monotone if any vertical line intersects the boundary of P in at most two points. Given a simple monotone polygon, P, with n vertices, show that you can find the convex hull
Suppose you are given an n-vertex convex polygon, P. Describe an O(n)-time method for computing the area of P.
Suppose you are hiking in the wild country of some exotic part of the world. Naturally, an important part of your survival gear is a GPS tracking device and a digital map of the region you are hiking
Computational metrology deals with algorithms for measuring things, such as manufactured parts, and one of the standard algorithms is to determine the flatness of an edge of a manufactured part based
Design an O(n)-time algorithm to test whether a given n-vertex polygon is convex. You should not assume that P is simple.
In the hidden-line elimination problem, we would like to visualize a threedimensional scene, described by a collection of polygons, from a particular viewing point, p, and in a particular direction.
Show that the expected number of points on the convex hull of a set of n points chosen uniformly and independently at random in the interior of a rectangle, R, is O(log n).
Line segments and polygons are used to model geometric objects in computer graphics, video games, and computer-aided design, often in data pipelines that use the output of one program as the input to
Gerrymandering is a process where voting districts are drawn to achieve various political goals, such as maximizing the number of voters from a certain party, rather than to achieve geometric goals,
In several computational geometry problems involving distances defined by a set, S, of n points in the plane, it is often useful to first know what is the largest distance between a pair of points in
Using the orientation test, give a pseudocode description of a method, inTriangle(p, q, r, s), which tests whether a point, p, is inside the interior of a triangle (q, r, s), assuming q, r, and s are
Describe an efficient method for inserting an object into a (balanced) priority search tree. What is the running time of this method?
Construct a priority search tree for the point set of Exercise R-21.7. Set of Exercise R-21.7{(1, 2),(4, 10),(14, 3),(6, 6),(3, 15),(2, 2),(3, 12),(9, 4),(12, 14)}.
Suppose we are given a range-searching data structure D that can answer rangesearching queries for a set of n points in d-dimensional space for any fixed dimension d (like 8, 10, or 20) in time that
Construct a k-d tree for the point set of Exercise R-21.7. Set of Exercise R-21.7{(1, 2),(4, 10),(14, 3),(6, 6),(3, 15),(2, 2),(3, 12),(9, 4),(12, 14)}.
Show how to extend the two-dimensional range tree so as to answer d-dimensional range-searching queries in O(logd n) time for a set of d-dimensional points, where d ≥ 2 is a constant.
Draw a quad-tree for the following set of points, assuming a 16 × 16 bounding box: {(1, 2),(4, 10),(14, 3),(6, 6),(3, 15),(2, 2),(3, 12),(9, 4),(12, 14)}.
When the Sload Digital Sky Survey decided to create a data structure for storing the objects identified by their projects, they needed a method for searching for two-dimensional points that are on a
Suppose a set S contains n two-dimensional points whose coordinates are all integers in the range [0, N]. What is the worst-case depth of a quadtree defined on S?
A higher-dimensional version of a quadtree is known as an octree, since, in three dimensions it divides each cube into 8 subcubes and recursively constructs an octree for each nonempty subcube as a
Design a static data structure (which does not support insertions and deletions) that stores a two-dimensional set S of n points and can answer, in O(log2 n) time, queries of the form
What is the worst-case depth of a k-d tree defined on n points in the plane? What about in higher dimensions?
In applications involving the use of quadtrees in memory-constrained devices, such as smartphones, we often want to optimize the data structure to make it more space efficient. One obvious
Describe an efficient data structure for storing a set S of n items with ordered keys, so as to support a rankRange(a, b) method, which enumerates all the items with keys whose rank in S is in the
Argue why the algorithm for answering three-sided range-searching queries with a priority search tree is correct.
Give a pseudocode description of an algorithm for constructing a range tree from a set of n points in the plane in O(n log n) time.
Show that the high y values in a priority search tree satisfy the heap-order property.
In some computer graphics and computer gaming applications, in order to save space, we might like to store a set of two-dimensional points in a single data structure that can be used for both
Let D be an ordered dictionary with n items implemented with a balanced search tree. Show how to implement the following method for D in time O(log n): countAllInRange(k1, k2): Compute and return the
Given a binary search tree, T, built on the x-coordinates of a set of n objects, describe an O(n)-time method for computing minx(v) and maxx(v) for every node, v, in T.
Show that the Marker algorithm is Hm-competitive when the size of the cache is m and there are m + 1 possible pages that can be accessed, where Hm denotes the mth Harmonic number.
The minx(v) and maxx(v) labels used in the two-dimensional range tree are not strictly needed. Describe an algorithm for performing a two-dimensional rangesearching query in a two-dimensional range
What is the expected number of block replacements performed by the Random policy on a cache of size m, for an access sequence of length n, that iteratively accesses m + 1 blocks in a cyclic fashion
What would be the worst-case space usage of a range tree, if the primary structure were not required to have O(log n) height?
Show that FIFO is m-competitive for any sequence of n page requests, where m is the size of the memory cache.
Show that LRU is m-competitive for any sequence of n page requests, where m is the size of the memory cache.
Consider the generalization of the renter’s dilemma where Alice can buy or rent her skis separate from her boots. Say that renting skis costs a dollars, whereas buying skis costs b dollars.
Suppose Alice is faced with the ski rental problem, where buying skis is 20 times more expensive than renting. In this case, however, Alice notices that she has a fair coin in her pocket and is
In the MapReduce framework, for performing a parallel computation, a crucial step involves an input that consists of a set of n key-value pairs, (k, v), for which we need to collect each subset of
Suppose you are processing an automated course registration program. The data set in this case is a large file of N course numbers, one for each course request made by a student. Show that you can
Imagine that you are trying to construct a minimum spanning tree for a large network, such as is defined by a popular social networking website. Based on using Kruskal’s algorithm, the bottleneck
Show how to implement a dictionary in external memory, using an unordered sequence so that insertions require only O(1)transfers and searches require O(n/B) transfers in the worst case, where n is
Describe, in detail, the insertion and removal algorithms for an (a, b) tree.
Show that the randomized quick-sort algorithm runs in O(n log n) time with high probability.
Give a pseudocode description of the remove dictionary operation, assuming the dictionary is implemented by a skip-list structure.
Suppose we have a Monte Carlo algorithm, A, and a deterministic algorithm, B, for testing if the output of A is correct. How can we use A and B to construct a Las Vegas algorithm? Also, if A succeeds
Draw an example skip list resulting from performing the following sequence of operations on the skip list in Figure 19.18: remove(38), insert(8,x), insert(24,y), remove(55). Assume the coin flips for
Show that if the compositeness witness function, witness(x, n), of the RabinMiller algorithm returns true, then the number n is composite.
Suppose we have a six-sided die, which we roll n times, and let X denote the number of times we role a 1. (a) What is E[X]? (b) Show that X < n/3 with high probability.
Give a randomized algorithm that computes all minimum cuts of a graph with high probability.
Given a parameter, k, suppose we wish to find a number, p, that is prime with probability 2−k. What is the asymptotic number of arithmetic operations needed?
Give an algorithm that computes a minimum cut of a graph with n vertices by O(n) applications of a maximum flow algorithm to a flow network derived from G.
Show that if we do all arithmetic modulo a prime number, p, then, for any integer x > 0, {ix mod p: i = 0, 1,...,p − 1} = {i : i = 0, 1,...,p − 1}. Use the fact that if p is prime,
Suppose that there is a collection of 3n distinct coupons, n of which are colored red and 2n of which are colored blue. Suppose that each time you go to a ticket window to get a coupon, the clerk
Showing 200 - 300
of 819
1
2
3
4
5
6
7
8
9