Algorithms 4th edition exercise answers.
1 | FUNDAMENTALS | |
1.2.13 | Transaction.java | transaction data type |
1.2.16 | Rational.java | rational number data type |
1.2.19 | Date.java | date data type |
1.3.1 | FixedCapacityStackOfStrings.java | add isFull() method to stack |
1.3.4 | Parentheses.java | balanced parentheses |
1.3.7 | Stack.java | add peek() method to stack |
1.3.10 | InfixToPostfix.java | infix-to-postfix conversion |
1.3.11 | EvaluatePostfix.java | evaluate a postfix expression |
1.3.14 | ResizingArrayQueue.java | resizing array queue |
1.3.37 | Josephus.java | Josephus problem |
1.4.14 | FourSum.java | brute-force 4-sum |
1.5.7 | QuickUnionUF.java | quick union |
1.5.7 | QuickFindUF.java | quick find |
1.5.17 | ErdosRenyi.java | Erdos-Renyi simulation |
2 | SORTING | |
2.1.1 | TraceSelection.java | trace of selection sort |
2.1.4 | TraceInsertion.java | trace of insertion sort |
2.1.9 | TraceShell.java | trace of shellsort |
2.1.21 | Transaction.java | add natural order to Transaction |
2.1.22 | SortTransactions.java | sort transactions |
2.1.23 | InsertionX.java | insertion sort with sentinel |
2.1.24 | InsertionX.java | insertion sort with half exchanges |
2.2.2 | TraceMerge.java | mergesort trace |
2.2.3 | TraceMergeBU.java | bottom-up mergesort trace |
2.2.9 | Merge.java | mergesort without static array |
2.2.11 | MergeX.java | improved mergesort |
2.2.19 | Inversions.java | count number of inversions |
2.2.20 | Merge.java | index sort |
2.3.1 | TracePartition.java | partition trace |
2.3.2 | TraceQuick.java | quicksort trace |
2.3.5 | Sort2distinct.java | sort array with 2 distinct keys |
2.3.12 | TraceQuick3way.java | 3-way quicksort trace |
2.3.16 | QuickBest.java | best-case for quicksort |
2.3.22 | QuickX.java | Bentley-McIlroy 3-way quicksort |
2.4.3 | OrderedArrayMaxPQ.java | ordered array priority queue |
2.4.3 | UnorderedArrayMaxPQ.java | unordered array priority queue |
2.4.15 | MaxPQ.java | check if an array is heap-ordered |
2.4.25 | CubeSum.java | find a^3 + b^3 = c^3 + d^3 |
2.4.33 | IndexMaxPQ.java | index priority queue |
2.5.8 | Frequency.java | count word frequencies |
2.5.12 | SPT.java | shortest processing time first rule |
2.5.13 | LPT.java | longest processing time first rule |
2.5.14 | Domain.java | sort by reverse domain name |
2.5.16 | California.java | 2003 California gubernatorial election order |
2.5.19 | KendallTau.java | Kendall Tau distance |
2.5.24 | StableMinPQ.java | stable priority queue |
2.5.25 | Point2D.java | point comparators |
2.5.27 | Insertion.java | index sort |
2.5.28 | FileSorter.java | sort files by name |
3 | SEARCHING | |
3.1.1 | GPA.java | compute GPA |
3.1.2 | ArrayST.java | unordered-array symbol table |
3.1.5 | SequentialSearchST.java | add size(), delete(), and keys() |
3.1.16 | BinarySearchST.java | add delete() |
3.1.17 | BinarySearchST.java | add floor() |
3.1.29 | TestBinarySearchST.java | test client |
3.1.30 | BinarySearchST.java | check internal invariants |
3.2.6 | BST.java | add height() method |
3.2.10 | TestBST.java | test client |
3.2.13 | NonrecursiveBST.java | nonrecursive BST |
3.2.24 | PerfectBalance.java | perfectly balanced BST |
3.2.32 | BST.java | order check |
3.2.33 | BST.java | rank/select check |
4 | GRAPHS | |
4.1.3 | Graph.java | add copy constructor |
4.1.13 | BreadthFirstPaths.java | add distTo() method |
4.1.23 | BaconHistogram.java | histogram of Bacon numbers |
4.1.26 | DegreesOfSeparationDFS.java | degrees of separation with DFS |
4.1.27 | MemoryOfGraph.java | memory of Graph data type |
4.1.36 | Bridge.java | find bridges |
4.2.3 | Digraph.java | add copy constructor |
4.2.21 | MemoryOfDigraph.java | memory of Digraph data type |
4.2.23 | DirectedEulerianCycle.java | directed Eulerian cycle |
4.2.31 | TopologicalQueue.java | queue-based topologial sort |
4.2.39 | WebCrawler.java | web crawler |
4.3.9 | EdgeWeightedGraph.java | edge-weighted graph constructor |
4.3.11 | MemoryOfEdgeWeightedGraph.java | memory of edge-weighted graph |
4.3.17 | EdgeWeightedGraph.java | add toString() to EdgeWeightedGraph |
4.3.21 | PrimMST.java | add edges() to PrimMST |
4.3.22 | PrimMST.java | minimum spanning forrest |
4.3.22 | KruskalMST.java | minimum spanning forrest |
4.3.33 | KruskalMST.java | MST certification |
4.3.43 | BoruvkaMST.java | Boruvka's algorithm |
4.4.2 | EdgeWeightedDigraph.java | add toString() method |
4.4.11 | MemoryOfEdgeWeightedDigraph.java | memory of EdgeWeightedDigraph data type |
4.4.12 | Topological.java | topological sort in edge-weighted digraphs |
4.4.12 | EdgeWeightedDirectedCycle.java | directed cycle in edge-weighted digraphs |
4.4.28 | AcyclicLP.java | longest paths in DAGs |
4.4.35 | LazyDijkstraSP.java | lazy implementation of Dijkstra |