Dataset Viewer
chapter_num
int64 1
6
| question_num
int64 1
57
| question
stringlengths 37
897
|
---|---|---|
1 | 1 |
Show the contents of the id[] array and the number of times the array is accessed for each input pair when you use quick‑find for the sequence 9‑0 3‑4 5‑8 7‑2 2‑1 5‑7 0‑3 4‑2.
|
1 | 2 |
Do Exercise 1.5.1, but use quick‑union (page 224). In addition, draw the forest of trees represented by the id[] array after each input pair is processed.
|
1 | 3 |
Do Exercise 1.5.1, but use weighted quick‑union (page 228).
|
1 | 4 |
Show the contents of the sz[] and id[] arrays and the number of array accesses for each input pair corresponding to the weighted quick‑union examples in the text (both the reference input and the worst‑case input).
|
1 | 5 |
Estimate the minimum amount of time (in days) that would be required for quick‑find to solve a dynamic connectivity problem with \(10^{9}\) sites and \(10^{6}\) input pairs, on a computer capable of executing \(10^{9}\) instructions per second. Assume that each iteration of the inner for loop requires 10 machine instructions.
|
1 | 6 |
Repeat Exercise 1.5.5 for weighted quick‑union.
|
1 | 7 |
Develop classes QuickUnionUF and QuickFindUF that implement quick‑union and quick‑find, respectively.
|
1 | 8 |
Give a counterexample that shows why this intuitive implementation of union() for quick‑find is not correct: ``java public void union(int p, int q) { if (connected(p, q)) return; // Rename p’s component to q’s name. for (int i = 0; i < id.length; i++) if (id[i] == id[p]) id[i] = id[q]; count--; } ``
|
1 | 9 |
Draw the tree corresponding to the id[] array depicted at right. Can this be the result of running weighted quick‑union? Explain why this is impossible or give a sequence of operations that results in this array. `` i 0 1 2 3 4 5 6 7 8 9 id[i] 1 1 3 1 5 6 1 3 4 5 ``
|
1 | 10 |
In the weighted quick‑union algorithm, suppose that we set id[find(p)] to q instead of to id[find(q)]. Would the resulting algorithm be correct? **Answer:** Yes, but it would increase the tree height, so the performance guarantee would be invalid.
|
1 | 11 |
Implement weighted quick‑find, where you always change the id[] entries of the smaller component to the identifier of the larger component. How does this change affect performance?
|
1 | 12 |
Quick‑union with path compression. Modify quick‑union (page 224) to include path compression, by adding a loop to union() that links every site on the paths from p and q to the roots of their trees to the root of the new tree. Give a sequence of input pairs that causes this method to produce a path of length 4. Note: The amortized cost per operation for this algorithm is known to be logarithmic.
|
1 | 13 |
Weighted quick‑union with path compression. Modify weighted quick‑union (Algorithm 1.5) to implement path compression, as described in Exercise 1.5.12. Give a sequence of input pairs that causes this method to produce a tree of height 4. Note: The amortized cost per operation for this algorithm is known to be bounded by a function known as the inverse Ackermann function and is less than 5 for any conceivable practical value of N.
|
1 | 14 |
Weighted quick‑union by height. Develop a UF implementation that uses the same basic strategy as weighted quick‑union but keeps track of tree height and always links the shorter tree to the taller one. Prove a logarithmic upper bound on the height of the trees for N sites with your algorithm.
|
1 | 15 |
Binomial trees. Show that the number of nodes at each level in the worst‑case trees for weighted quick‑union are binomial coefficients. Compute the average depth of a node in a worst‑case tree with \(N = 2^{n}\) nodes.
|
1 | 16 |
Amortized costs plots. Instrument your implementations from Exercise 1.5.7 to make amortized costs plots like those in the text.
|
1 | 17 |
Random connections. Develop a UF client **ErdosRenyi** that takes an integer value N from the command line, generates random pairs of integers between 0 and N‑1, calling connected() to determine if they are connected and then union() if not (as in our development client), looping until all sites are connected, and printing the number of connections generated. Package your program as a static method count() that takes N as argument and returns the number of connections and a main() that takes N from the command line, calls count(), and prints the returned value.
|
1 | 18 |
Random grid generator. Write a program **RandomGrid** that takes an int value N from the command line, generates all the connections in an \(N\times N\) grid, puts them in random order, randomly orients them (so that p q and q p are equally likely to occur), and prints the result to standard output. To randomly order the connections, use a RandomBag (see Exercise 1.3.34 on page 167). To encapsulate p and q in a single object, use the Connection nested class shown below. Package your program as two static methods: generate(), which takes N as argument and returns an array of connections, and main(), which takes N from the command line, calls generate(), and iterates through the returned array to print the connections.
|
1 | 19 |
Animation. Write a RandomGrid client (see Exercise 1.5.18) that uses UnionFind as in our development client to check connectivity and uses StdDraw to draw the connections as they are processed.
|
1 | 20 |
Dynamic growth. Using linked lists or a resizing array, develop a weighted quick‑union implementation that removes the restriction on needing the number of objects ahead of time. Add a method newSite() to the API, which returns an int identifier.
|
1 | 21 |
Erdös‑Renyi model. Use your client from Exercise 1.5.17 to test the hypothesis that the number of pairs generated to get one component is \(\sim \tfrac{1}{2}N\ln N\).
|
1 | 22 |
Doubling test for Erdös‑Renyi model. Develop a performance‑testing client that takes an int value T from the command line and performs T trials of the following experiment: Use your client from Exercise 1.5.17 to generate random connections, using UnionFind to determine connectivity as in our development client, looping until all sites are connected. For each N, print the value of N, the average number of connections processed, and the ratio of the running time to the previous. Use your program to validate the hypotheses in the text that the running times for quick‑find and quick‑union are quadratic and weighted quick‑union is near‑linear.
|
1 | 23 |
Compare quick‑find with quick‑union for Erdös‑Renyi model. Develop a performance‑testing client that takes an int value T from the command line and performs T trials of the following experiment: Use your client from Exercise 1.5.17 to generate random connections. Save the connections, so that you can use both quick‑union and quick‑find to determine connectivity as in our development client, looping until all sites are connected. For each N, print the value of N and the ratio of the two running times.
|
1 | 24 |
Fast algorithms for Erdös‑Renyi model. Add weighted quick‑union and weighted quick‑union with path compression to your tests from Exercise 1.5.23. Can you discern a difference between these two algorithms?
|
1 | 25 |
Doubling test for random grids. Develop a performance‑testing client that takes an int value T from the command line and performs T trials of the following experiment: Use your client from Exercise 1.5.18 to generate the connections in an \(N\times N\) square grid, randomly oriented and in random order, then use UnionFind to determine connectivity as in our development client, looping until all sites are connected. For each N, print the value of N, the average number of connections processed, and the ratio of the running time to the previous. Use your program to validate the hypotheses in the text that the running times for quick‑find and quick‑union are quadratic and weighted quick‑union is near‑linear. Note: As N doubles, the number of sites in the grid increases by a factor of 4, so expect a doubling factor of 16 for quadratic and 4 for linear.
|
2 | 1 |
Consider the following implementation of the compareTo() method for String. How does the third line help with efficiency? ``java public int compareTo(String that) { if (this == that) return 0; // this line int n = Math.min(this.length(), that.length()); for (int i = 0; i < n; i++) { if (this.charAt(i) < that.charAt(i)) return -1; else if (this.charAt(i) > that.charAt(i)) return +1; } return this.length() - that.length(); } ``
|
2 | 2 |
Write a program that reads a list of words from standard input and prints all two‑word compound words in the list. For example, if after, thought, and afterthought are in the list, then afterthought is a compound word.
|
2 | 3 |
Criticize the following implementation of a class intended to represent account balances. Why is compareTo() a flawed implementation of the Comparable interface? ``java public class Balance implements Comparable<Balance> { ... private double amount; public int compareTo(Balance that) { if (this.amount < that.amount - 0.005) return -1; if (this.amount > that.amount + 0.005) return +1; return 0; } ... } `` Describe a way to fix this problem.
|
2 | 4 |
Implement a method String[] dedup(String[] a) that returns the objects in a[] in sorted order, with duplicates removed.
|
2 | 5 |
Explain why selection sort is not stable.
|
2 | 6 |
Implement a recursive version of select().
|
2 | 7 |
About how many compares are required, on the average, to find the smallest of \(N\) items using select()?
|
2 | 8 |
Write a program Frequency that reads strings from standard input and prints the number of times each string occurs, in descending order of frequency.
|
2 | 9 |
Develop a data type that allows you to write a client that can sort a file such as the one shown at right. *(The file listing is omitted here.)*
|
2 | 10 |
Create a data type Version that represents a software version number, such as 115.1.1, 115.10.1, 115.10.2. Implement the Comparable interface so that 115.1.1 is less than 115.10.1, and so forth.
|
2 | 11 |
One way to describe the result of a sorting algorithm is to specify a permutation p[] of the numbers 0 to a.length-1, such that p[i] specifies where the key originally in a[i] ends up. Give the permutations that describe the results of insertion sort, selection sort, shellsort, mergesort, quicksort, and heapsort for an array of seven equal keys.
|
2 | 12 |
Scheduling. Write a program SPT.java that reads job names and processing times from standard input and prints a schedule that minimizes average completion time using the shortest processing time first rule, as described on page 349.
|
2 | 13 |
Load balancing. Write a program LPT.java that takes an integer M as a command‑line argument, reads job names and processing times from standard input and prints a schedule assigning the jobs to M processors that approximately minimizes the time when the last job completes using the longest processing time first rule, as described on page 349.
|
2 | 14 |
Sort by reverse domain. Write a data type Domain that represents domain names, including an appropriate compareTo() method where the natural order is in order of the reverse domain name. For example, the reverse domain of cs.princeton.edu is edu.princeton.cs. This is useful for web log analysis. Hint: Use s.split("\\.") to split the string s into tokens, delimited by dots. Write a client that reads domain names from standard input and prints the reverse domains in sorted order.
|
2 | 15 |
Spam campaign. To initiate an illegal spam campaign, you have a list of email addresses from various domains (the part of the email address that follows the @ symbol). To better forge the return addresses, you want to send the email from another user at the same domain. For example, you might want to forge an email from [email protected] to [email protected]. How would you process the email list to make this an efficient task?
|
2 | 16 |
Unbiased election. In order to thwart bias against candidates whose names appear toward the end of the alphabet, California sorted the candidates appearing on its 2003 gubernatorial ballot by using the following order of characters: R W Q O J M V A H B S G Z X N T C I E K U P D Y F L. Create a data type where this is the natural order and write a client California with a single static method main() that sorts strings according to this ordering. Assume that each string is composed solely of uppercase letters.
|
2 | 17 |
Check stability. Extend your check() method from Exercise 2.1.16 to call sort() for a given array and return true if sort() sorts the array in order in a stable manner, false otherwise. Do not assume that sort() is restricted to move data only with exch().
|
2 | 18 |
Force stability. Write a wrapper method that makes any sort stable by creating a new key type that allows you to append each key’s index to the key, call sort(), then restore the original key after the sort.
|
2 | 19 |
Kendall tau distance. Write a program KendallTau.java that computes the Kendall tau distance between two permutations in linearithmic time.
|
2 | 20 |
Idle time. Suppose that a parallel machine processes \(N\) jobs. Write a program that, given the list of job start and finish times, finds the largest interval where the machine is idle and the largest interval where the machine is not idle.
|
2 | 21 |
Multidimensional sort. Write a Vector data type for use in having the sort‑ing methods sort multidimensional vectors of \(d\) integers, putting the vectors in order by first component, those with equal first component in order by second component, those with equal first and second components in order by third component, and so forth.
|
2 | 22 |
Stock market trading. Investors place buy and sell orders for a particular stock on an electronic exchange, specifying a maximum buy or minimum sell price that they are willing to pay, and how many shares they wish to trade at that price. Develop a program that uses priority queues to match up buyers and sellers and test it through simulation. Maintain two priority queues, one for buyers and one for sellers, executing trades whenever a new order can be matched with an existing order or orders.
|
2 | 23 |
Sampling for selection. Investigate the idea of using sampling to improve selection. Hint: Using the median may not always be helpful.
|
2 | 24 |
Stable priority queue. Develop a stable priority‑queue implementation (which returns duplicate keys in the same order in which they were inserted).
|
2 | 25 |
Points in the plane. Write three static comparators for the Point2D data type of page 77, one that compares points by their \(x\) coordinate, one that compares them by their \(y\) coordinate, and one that compares them by their distance from the origin. Write two non‑static comparators for the Point2D data type, one that compares them by their distance to a specified point and one that compares them by their polar angle with respect to a specified point.
|
2 | 26 |
Simple polygon. Given \(N\) points in the plane, draw a simple polygon with \(N\) vertices. Hint: Find the point \(p\) with the smallest \(y\) coordinate, breaking ties with the smallest \(x\) coordinate. Connect the points in increasing order of the polar angle they make with \(p\).
|
2 | 27 |
Sorting parallel arrays. When sorting parallel arrays, it is useful to have a version of a sorting routine that returns a permutation, say index[], of the indices in sorted order. Add a method indirectSort() to Insertion that takes an array of Comparable objects a[] as argument, but instead of rearranging the entries of a[] returns an integer array index[] so that a[index[0]] through a[index[N-1]] are the items in ascending order.
|
2 | 28 |
Sort files by name. Write a program FileSorter that takes the name of a directory as a command‑line argument and prints out all of the files in the current directory, sorted by file name. Hint: Use the File data type.
|
2 | 29 |
Sort files by size and date of last modification. Write comparators for the type File to order by increasing/decreasing order of file size, ascending/descending order of file name, and ascending/descending order of last modification date. Use these comparators in a program LS that takes a command‑line argument and lists the files in the current directory according to a specified order, e.g., “-t” to sort by timestamp. Support multiple flags to break ties. Be sure to use a stable sort.
|
2 | 30 |
Boerner’s theorem. True or false: If you sort each column of a matrix, then sort each row, the columns are still sorted. Justify your answer.
|
2 | 31 |
Duplicates. Write a client that takes integers M, N, and T as command‑line arguments, then uses the code given in the text to perform T trials of the following experiment: Generate N random int values between 0 and M – 1 and count the number of duplicates. Run your program for T = 10 and N = 10^3, 10^4, 10^5, and 10^6, with M = N / 2, N, and 2N. Probability theory says that the number of duplicates should be about \((1 – e^{-\lambda})\) where \(\lambda = N / M\) — print a table to help you confirm that your experiments validate that formula.
|
2 | 32 |
8 puzzle. The 8 puzzle is a game popularized by S. Loyd in the 1870s. It is played on a 3‑by‑3 grid with 8 tiles labeled 1 through 8 and a blank square. Your goal is to rearrange the tiles so that they are in order. You are permitted to slide one of the available tiles horizontally or vertically (but not diagonally) into the blank square. Write a program that solves the puzzle using the A* algorithm. Start by using as priority the sum of the number of moves made to get to this board position plus the number of tiles in the wrong position. (Note that the number of moves you must make from a given board position is at least as big as the number of tiles in the wrong place.) Investigate substituting other functions for the number of tiles in the wrong position, such as the sum of the Manhattan distance from each tile to its correct position, or the sums of the squares of these distances.
|
2 | 33 |
Random transactions. Develop a generator that takes an argument N, generates N random Transaction objects (see Exercises 2.1.21 and 2.1.22), using assumptions about the transactions that you can defend. Then compare the performance of shellsort, mergesort, quicksort, and heapsort for sorting N transactions, for N=10^3, 10^4, 10^5, and 10^6.
|
2 | 1 |
Implement SET and HashSET as “wrapper class” clients of ST and HashST, respectively (provide dummy values and ignore them).
|
2 | 2 |
Develop a SET implementation SequentialSearchSET by starting with the code for SequentialSearchST and eliminating all of the code involving values.
|
2 | 3 |
Develop a SET implementation BinarySearchSET by starting with the code for BinarySearchST and eliminating all of the code involving values.
|
2 | 4 |
Develop classes HashSTint and HashSTdouble for maintaining sets of keys of primitive int and double types, respectively. (Convert generics to primitive types in the code of LinearProbingHashST.)
|
2 | 5 |
Develop classes STint and STdouble for maintaining ordered symbol tables where keys are primitive int and double types, respectively. (Convert generics to primitive types in the code of RedBlackBST.) Test your solution with a version of SparseVector as a client.
|
2 | 6 |
Develop classes HashSETint and HashSETdouble for maintaining sets of keys of primitive int and double types, respectively. (Eliminate code involving values in your solution to Exercise 3.5.4.)
|
2 | 7 |
Develop classes SETint and SETdouble for maintaining ordered sets of keys of primitive int and double types, respectively. (Eliminate code involving values in your solution to Exercise 3.5.5.)
|
2 | 8 |
Modify LinearProbingHashST to keep duplicate keys in the table. Return any value associated with the given key for get(), and remove all items in the table that have keys equal to the given key for delete.
|
2 | 9 |
Modify BST to keep duplicate keys in the tree. Return any value associated with the given key for get(), and remove all nodes in the tree that have keys equal to the given key for delete.
|
2 | 10 |
Modify RedBlackBST to keep duplicate keys in the tree. Return any value associated with the given key for get(), and remove all nodes in the tree that have keys equal to the given key for delete.
|
2 | 11 |
Develop a MultiSET class that is like SET, but allows equal keys and thus implements a mathematical multiset.
|
2 | 12 |
Modify LookupCSV to associate with each key all values that appear in a key‑value pair with that key in the input (not just the most recent, as in the associative‑array abstraction).
|
2 | 13 |
Modify LookupCSV to make a program RangeLookupCSV that takes two key values from the standard input and prints all key‑value pairs in the .csv file such that the key falls within the range specified.
|
2 | 14 |
Develop and test a static method invert() that takes as argument an ST<String, Bag<String>> and produces as return value the inverse of the given symbol table (a symbol table of the same type).
|
2 | 15 |
Write a program that takes a string on standard input and an integer k as command‑line argument and puts on standard output a sorted list of the k‑grams found in the string, each followed by its index in the string.
|
2 | 16 |
Add a method sum() to SparseVector that takes a SparseVector as argument and returns a SparseVector that is the term‑by‑term sum of this vector and the argument vector. Note: You need delete() (and special attention to precision) to handle the case where an entry becomes 0.
|
2 | 17 |
Mathematical sets. Your goal is to develop an implementation of the following API MathSET for processing (mutable) mathematical sets: `` public class MathSET<Key> MathSET(Key[] universe) // create a set void add(Key key) // put key into the set MathSET<Key> complement() // set of keys in the universe that are not in this set void union(MathSET<Key> a) // put any keys from a into the set that are not already there void intersection(MathSET<Key> a) // remove any keys from this set that are not in a void delete(Key key) // remove key from the set boolean contains(Key key) // is key in the set? boolean isEmpty() // is the set empty? int size() // number of keys in the set `` Use a symbol table. Extra credit: Represent sets with arrays of boolean values.
|
2 | 18 |
Multisets. After referring to Exercises 3.5.2 and 3.5.3 and the previous exercise, develop APIs MultiHashSET and MultiSET for multisets (sets that can have equal keys) and implementations SeparateChainingMultiSET and BinarySearchMultiSET for multisets and ordered multisets, respectively.
|
2 | 19 |
Equal keys in symbol tables. Consider the API MultiST (unordered or ordered) to be the same as our symbol‑table APIs defined on pages 363 and 366, but with equal keys allowed, so that the semantics of get() is to return any value associated with the given key, and we add a new method `` Iterable<Value> getAll(Key key) // returns all values associated with the given key `` Using our code for SeparateChainingST and BinarySearchST as a starting point, develop implementations SeparateChainingMultiST and BinarySearchMultiST for these APIs.
|
2 | 20 |
Concordance. Write an ST client Concordance that puts on standard output a concordance of the strings in the standard input stream (see page 498).
|
2 | 21 |
Inverted concordance. Write a program InvertedConcordance that takes a concordance on standard input and puts the original string on standard output stream. Note: This computation is associated with a famous story having to do with the Dead Sea Scrolls. The team that discovered the original tablets enforced a secrecy rule that essentially resulted in their making public only a concordance. After a while, other researchers figured out how to invert the concordance, and the full text was eventually made public.
|
2 | 22 |
Fully indexed CSV. Implement an ST client FullLookupCSV that builds an array of ST objects (one for each field), with a test client that allows the user to specify the key and value fields in each query.
|
2 | 23 |
Sparse matrices. Develop an API and an implementation for sparse 2D matrices. Support matrix addition and matrix multiplication. Include constructors for row and column vectors.
|
2 | 24 |
Non‑overlapping interval search. Given a list of non‑overlapping intervals of items, write a function that takes an item as argument and determines in which, if any, interval that item lies. For example, if the items are integers and the intervals are 1643‑2033, 5532‑7643, 8999‑10332, 5666653‑5669321, then the query point 9122 lies in the third interval and 8122 lies in no interval.
|
2 | 25 |
Registrar scheduling. The registrar at a prominent northeastern University recently scheduled an instructor to teach two different classes at the same exact time. Help the registrar prevent future mistakes by describing a method to check for such conflicts. For simplicity, assume all classes run for 50 minutes starting at 9:00, 10:00, 11:00, 1:00, 2:00, or 3:00.
|
2 | 26 |
LRU cache. Create a data structure that supports the following operations: access and remove. The access operation inserts the item onto the data structure if it’s not already present. The remove operation deletes and returns the item that was least recently accessed. Hint: Maintain the items in order of access in a doubly linked list, along with pointers to the first and last nodes. Use a symbol table with keys = items, values = location in linked list. When you access an element, delete it from the linked list and reinsert it at the beginning. When you remove an element, delete it from the end and remove it from the symbol table.
|
2 | 27 |
List. Develop an implementation of the following API: `` public class List<Item> implements Iterable<Item> List() // create a list void addFront(Item item) // add item to the front void addBack(Item item) // add item to the back Item deleteFront() // remove from the front Item deleteBack() // remove from the back void delete(Item item) // remove item from the list void add(int i, Item item) // add item as the ith in the list Item delete(int i) // remove the ith item from the list boolean contains(Item item) // is key in the list? boolean isEmpty() // is the list empty? int size() // number of items in the list `` Hint: Use two symbol tables, one to find the ith item in the list efficiently, and the other to efficiently search by item. (Java’s java.util.List interface contains methods like these but does not supply any implementation that efficiently supports all operations.)
|
2 | 28 |
UniQueue. Create a data type that is a queue, except that an element may only be inserted into the queue once. Use an existence symbol table to keep track of all elements that have ever been inserted and ignore requests to re‑insert such items.
|
2 | 29 |
Symbol table with random access. Create a data type that supports inserting a key‑value pair, searching for a key and returning the associated value, and deleting and returning a random key. Hint: Combine a symbol table and a randomized queue.
|
2 | 30 |
Duplicates (revisited). Redo Exercise 2.5.31 using the Dedup filter given on page 490. Compare the running times of the two approaches. Then use Dedup to run the experiments for N = 10⁷, 10⁸, and 10⁹, repeat the experiments for random long values and discuss the results.
|
2 | 31 |
Spell checker. With the file dictionary.txt from the booksite as command‑line argument, the BlackFilter client described on page 491 prints all misspelled words in a text file taken from standard input. Compare the performance of RedBlackBST, SeparateChainingHashST, and LinearProbingHashST for the file WarAndPeace.txt (available on the booksite) with this client and discuss the results.
|
2 | 32 |
Dictionary. Study the performance of a client like LookupCSV in a scenario where performance matters. Specifically, design a query‑generation scenario instead of taking commands from standard input, and run performance tests for large inputs and large numbers of queries.
|
2 | 33 |
Indexing. Study a client like LookupIndex in a scenario where performance matters. Specifically, design a query‑generation scenario instead of having commands from standard input, and run performance tests for large inputs and large numbers of queries.
|
2 | 34 |
Sparse vector. Run experiments to compare the performance of matrix‑vector multiplication using SparseVector to the standard implementation using arrays.
|
2 | 35 |
Primitive types. Evaluate the utility of using primitive types for Integer and Double values, for LinearProbingHashST and RedBlackBST. How much space and time are saved, for large numbers of searches in large tables?
|
4 | 1 |
True or false: Adding a constant to every edge weight does not change the solution to the single‑source shortest‑paths problem.
|
4 | 2 |
Provide an implementation of toString() for EdgeWeightedDigraph.
|
4 | 3 |
Develop an implementation of EdgeWeightedDigraph for dense graphs that uses an adjacency‑matrix (two‑dimensional array of weights) representation (see Exercise 4.3.9). Ignore parallel edges.
|
4 | 4 |
Draw the SPT for source 0 of the edge‑weighted digraph obtained by deleting vertex 7 from tinyEWD.txt (see page 644), and give the parent‑link representation of the SPT. Answer the question for the same graph with all edges reversed.
|
4 | 5 |
Change the direction of edge 0→2 in tinyEWD.txt (see page 644). Draw two different SPTs that are rooted at 2 for this modified edge‑weighted digraph.
|
4 | 6 |
Give a trace that shows the process of computing the SPT of the digraph defined in Exercise 4.4.5 with the eager version of Dijkstra’s algorithm.
|
4 | 7 |
Develop a version of DijkstraSP that supports a client method that returns a second shortest path from s to t in an edge‑weighted digraph (and returns null if there is only one shortest path from s to t).
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 83