Similar Books


    No books found

Title
Chapter: 25 / Q: 19
(Decompress a file) The preceding exercise compresses a file. The compressed file contains the Huffman codes and the compressed contents. Write a program that decompresses a source file into a target file using the following command: java Exercise25_19 sourcefile targetfile
Chapter: 25 / Q: 20
(Bin packing using first fit) Write a program that packs the objects of various weights into containers. Each container can hold a maximum of 10 pounds. The program uses a greedy algorithm that places an object into the first bin in which it would fit. Your program should prompt the user to enter
Chapter: 25 / Q: 21
(Bin packing with smallest object first) Rewrite the preceding program that uses a new greedy algorithm that places an object with the smallest weight into the first bin in which it would fit
Chapter: 25 / Q: 22
(Bin packing with largest object first) Rewrite the preceding program that places an object with the largest weight into the first bin in which it would fit. Give an example to show that this program does not produce an optimal solution
Chapter: 25 / Q: 23
(Optimal bin packing) Rewrite the preceding program so that it finds an optimal solution that packs all objects using the smallest number of containers. Here is a sample run of the program:
Chapter: 26 / Q: 1
(Display AVL tree graphically) Write a program that displays an AVL tree along with its balance factor for each node
Chapter: 26 / Q: 2
(Compare performance) Write a test program that randomly generates 500,000 numbers and inserts them into a BST, reshuffles the 500,000 numbers and performs a search, and reshuffles the numbers again before deleting them from the tree
Chapter: 26 / Q: 3
(AVL tree animation) Write a program that animates the AVL tree insert, delete, and search methods, as shown in Figure 26.1
Chapter: 26 / Q: 4
(Parent reference for BST) Suppose that the TreeNode class defined in BST contains a reference to the node’s parent, as shown in Programming Exercise 25.15
Chapter: 26 / Q: 5
(The kth smallest element) You can find the kth smallest element in a BST in O(n) time from an inorder iterator. For an AVL tree, you can find it in O(log n) time. To achieve this, add a new data field named size in AVLTreeNode to store the number of nodes in the subtree rooted at this node
total questions: 772

Questions

772

Views

A PHP Error was encountered

Severity: Warning

Message: Undefined property: stdClass::$TotalViews

Filename: books/book.php

Line Number: 411

Best Answers

299

Points

5