Show that n log n is (n).
Show that n i=1 i 2 is O(n 3 ).
Describe an implementation of the PositionalList methods add last and add before realized by using only methods in the set {is empty, first, last, prev, next, add after, and add first}.
Implement a function that counts the number of nodes in a circularly linked list.
Alice has two queues, Q and R, which can store integers. Bob gives Alice 50 odd integers and 50 even integers and insists that she store all 100 integers in Q and R. They then play a game where Bob...
The input of an LTI continuous-time system is x(t) = u(t) - u(t 3.5). The systems impulse response is h(t) = u(t) - u(t 2.5). (a) Find the systems output y(t) by graphically computing the...
Describe a recursive function for converting a string of digits into the integer it represents. For example, '13531' represents the integer 13,531.
Consider a situation in which a user has numeric keys and wishes to have a priority queue that is maximum-oriented. How could a standard (minoriented) priority queue be used for such a purpose?
The signal at the input of an AM receiver is u(t) = m 1 (t) cos(20t) + m 2 (t) cos(100t) where the messages m i (t), i = 1; 2 are the outputs of a lowpass Butterworth filter with inputs x 1 (t) =...
On page 406 of Section 10.1.3, we give an implementation of the method setdefault as it might appear in the MutableMapping abstract base class. While that method accomplishes the goal in a general...
Average acceleration is defined as the change of velocity divided by the time taken to make the change, as shown in the following formula: Write a program that prompts the user to enter the starting...
Suppose you save $100 each month into a savings account with the annual interest rate 5%. Thus, the monthly interest rate is 0.05/12 = 0.00417. After the first month, the value in the account becomes...
Listing 3.3, SubtractionQuiz.java, randomly generates a subtraction question. Revise the program to randomly generate an addition question with two integers less than 100. Listing 3.3 1 import...
Zeller?s congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is where ? h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4:...
Suppose you shop for rice in two different packages. You would like to write a program to compare the cost. The program prompts the user to enter the weight and price of the each package and displays...
The classic Eight Queens puzzle is to place eight queens on a chessboard such that no two queens can attack each other (i.e., no two queens are on the same row, same column, or same diagonal). There...
The area of a hexagon can be computed using the following formula (s is the length of a side): Write a program that prompts the user to enter the side of a hexagon and displays its area. Here is a...
Another solution for Listing 5.9 to find the greatest common divisor of two integers n1 and n2 is as follows: First find d to be the minimum of n1 and n2, then check whether d, d-1, d-2, . . . , 2,...
Programming Exercise 3.21 uses Zeller?s congruence to calculate the day of the week. Simplify Listing 6.12, PrintCalendar.java, using Zeller?s algorithm to get the start day of the month. Listing...
Suppose you have a lot of files in a directory named Exercisei_j, where i and j are digits. Write a program that pads a 0 before j if j is a single digit. For example, a file named Exercise2_1 in a...
A school has 100 lockers and 100 students. All lockers are closed on the first day of school. As the students enter, the first student, denoted S1, opens every locker. Then the second student, S2,...
Implement the following method to sort the columns in a twodimensional array. A new array is returned and the original array is intact.public static double[][] sortColumns(double[][] m)Write a test...
Suppose the weekly hours for all employees are stored in a two-dimensional array. Each row records an employee?s seven-day work hours with seven columns. For example, the following array stores the...
Write a program that repeatedly prompts the user to enter a capital for a state. Upon receiving the user input, the program reports whether the answer is correct. Assume that 50 states and their...
Use the Account class created in Programming Exercise 9.7 to simulate an ATM machine. Create ten accounts in an array with id 0, 1, . . . , 9, and initial balance $100. The system prompts the user to...
Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address. A student...
Write a program to display a recursive tree as shown in Figure 18.20. 1 Enter an order: Enter an order: Enter an order: Enter an order: 5 (b) (a)
Write a program that replaces all occurrences of a word with a new word in all the files under a directory, recursively. Pass the parameters from the command line as follows: java Exercise18_31...
The two-dimensional arrays m1 and m2 are strictly identical if their corresponding elements are equal. Write a method that returns true if m1 and m2 are strictly identical, using the following...
Write a program that stores an array of the five int values 1, 2, 3, 4, and 5, a Date object for the current time, and the double value 5.5 into the file named Exercise17_05.dat.
Write a program that reads lines of characters from a text file and writes each line as a UTF-8 string into a binary file. Display the sizes of the text file and the binary file. Use the following...
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...
Add a method in the BST class to return the number of the nonleaves as follows: /** Returns the number of nonleaf nodes */ public int getNumberofNonLeaves()
Implement the postorder method in BST using a stack instead of recursion. Write a test program that prompts the user to enter 10 integers, stores them in a BST, and invokes the postorder method to...
Write a program that converts the Java source code from the next-line brace style to the end-of-line brace style. For example, the following Java source in (a) uses the next-line brace style. Your...
Write a program that displays a clock and sets the time with the input from three text fields, as shown in Figure 16.38b. Use the ClockPane in Listing 14.21. Resize the clock to the center of the...
The text introduced Prims algorithm for finding a minimum spanning tree. Kruskals algorithm is another well-known algorithm for finding a minimum spanning tree. The algorithm repeatedly finds a...
Implement the following method using Fork/Join to find the sum of a list. public static double parallelSum(double[] list) Write a test program that finds the sum in a list of 9,000,000 double values.
Write pseudocode for the procedures HEAP-MINIMUM, HEAP-EXTRACT-MIN, HEAP-DECREASE-KEY, and MIN-HEAP-INSERT that implement a min-priority queue with a min-heap.
Argue that for any constant 0 < 1/2, the probability is approximately 1 - 2 that on a random input array, PARTITION produces a split more balanced than 1 to .
Consider a hash table of size m = 1000 and a corresponding hash function h(k) = m(kA mod 1) for A = (5 1)/2. Compute the locations to which the keys 61, 62, 63, 64, and 65 are mapped.
Consider n chords on a circle, each defined by its endpoints. Describe an O(n lg n)- time algorithm to determine the number of pairs of chords that intersect inside the circle. (For example, if the n...
Determine the cost and structure of an optimal binary search tree for a set of n = 7 keys with the following probabilities: 1 0.04 0.06 i 3 4 5 6. 7 Pi 0.08 0.02 0.10 0.12 0.14 0.06 0.06 0.06 0.06...
Revise the program in Listing 21.7. If a keyword is in a comment or in a string, don?t count it. Pass the Java file name from the command line. Assume that the Java source code is correct and line...
Show that the Bellman-Ford algorithm, when run on the constraint graph for a system Ax b of difference constraints, minimizes the quantity (max {x i } min {x i }) subject to Ax b. Explain how this...
Write a GUI application that lets the user enter a file name in the text field and press the Enter key to display its binary representation in a text area. The user can also modify the binary code...
Prove that matrix inverses are unique, that is, if B and C are inverses of A, then B = C.
Write a program that can dynamically change the font of a text in a label displayed on a stack pane. The text can be displayed in bold and italic at the same time. You can select the font name or...
Define the following methods in MyList and implement them in MyAbstractList: Write a test program that creates two MyArrayLists, list1 and list2, with the initial values {"Tom", "George", "Peter",...
Write a short Java method, inputAllBaseTypes, that inputs a different value of each base type from the standard input device and prints it back to the standard output device.
Describe a way to use recursion to compute the sum of all the elements in an nn (two-dimensional) array of integers.
Write a recursive method that will output all the subsets of a set of n elements (without repeating any subsets).
Give a recursive definition of a singly linked list class that does not use any Node class.
Let H be a heap storing 15 entries using the array-based representation of a complete binary tree. What is the sequence of indices of the array that are visited in a preorder traversal of H? What...
Draw the binary tree representation of the following arithmetic expression: (((5+2) (21))/((2+9)+((72)1)) 8).
Write a program that takes as input a fully parenthesized, arithmetic expression and converts it to a binary expression tree. Your program should display the tree in some way and also print the value...
Modify GraphView in Listing 28.6 to add a new data field tree with a set method. The edges in the tree are displayed in red. Write a program that displays the graph in Figure 28.1 and the DFS/BFS...
Linda claims to have an algorithm that takes an input sequence S and produces an output sequence T that is a sorting of the n elements in S. a. Give an algorithm, isSorted, that tests in O(n) time if...
Suppose we are given two sequences A and B of n elements, possibly containing duplicates, on which a total order relation is defined. Describe an efficient algorithm for determining if A and B...
The square of a directed graph G = (V, E) is the graph G 2 = (V, E 2 ) such that (u, ) E 2 if and only G contains a path with at most two edges between u and . Describe efficient algorithms for...
Draw a simple, connected, undirected, weighted graph with 8 vertices and 16 edges, each with unique edge weights. Illustrate the execution of the Prim-Jarnik algorithm for computing the minimum...
Let G be an undirected graph with n vertices and m edges. Describe an O(n+m)-time algorithm for traversing each edge of G exactly once in each direction.
Create a sample XML document and DTD for the exchange of student transcript data. Use your college transcript as a sample.
Explain and contrast the differences and similarities between the DBA and DA.
Describe the activities that are typically associated with the design and implementation services of the DBA technical function. What technical skills are desirable in the DBA's personnel?
Using SQL statements, give some examples of how you would use the data dictionary to monitor the security of the database.
Can edge list E be omitted from the adjacency matrix representation while still achieving the time bounds given in Table 14.1? Why or why not? Edge List | Adj. List O(1) 0(1) O(n) O(m) O(m) O(m) Adj....
Repeat Exercise R-14.28 for Figure 14.11 illustrating the Floyd-Warshall algorithm. Repeat Exercise Describe the meaning of the graphical conventions used in Figure 14.9 illustrating a DFS traversal....
Many system architects base their IT system designs on an n-tier architecture, where n is a number with value 2 or greater. Explain the difference between a single-tier architecture and an n-tier...
The definition of an operating system specifies two primary purposes served by the operating system. What are they?
Describe the contents and format of a free space bitmap.
Design a survey form of your own. Fill it out as it might have been completed during the database design forHenry Books. For any questions you have too little information to answer, make a reasonable...
Use a TextArea, and its setText() and append() methods to write an application that allows the user to select options for a dormitory room. Use CheckBoxes for options such as private room, Internet...
In what common situation is the document returned by a Web server created after the request is received?
The Donut Shoppe sells four varieties of doughnuts: Glazed ($1.05), Sugar ($1.05), Chocolate ($1.25), and Filled ($1.50). It also sells regular coffee ($1.50) and cappuccino ($2.75). The store...
If the strName variable contains the string Sharon Kelper, which of the following changes the contents of the variable to the string Sharon P. Kelper? a. strName = strName.Insert(6, " P.") b. strName...
Which of the following statements assigns the first four characters in the strItem variable to the strWarehouse variable? a. strWarehouse = strItem.Assign(0, 4) b. strWarehouse = strItem.Assign(1, 4)...
If the strWord variable contains the string crispy, which of the following statements assigns the letter s to the strLetter variable? a. strLetter = strWord.Substring(3) b. strLetter =...
Which of the following statements changes the contents of the strZip variable from 60521 to 60461? a. strZip = strZip.Insert(2, "46") strZip = strZip.Remove(4, 2) b. strZip = strZip.Remove(2) strZip...
Which of the following statements changes the contents of the strSocSec variable from 000-11-2222 to 000112222? a. strSocSec = strSocSec.Remove("") b. strSocSec = strSocSec.RemoveAll("") c. strSocSec...
Which of the following statements generates a random integer from 1 to 25 (including 25)? a. intNum = randGen.Next(1, 25) b. intNum = randGen.Next(1, 26) c. intNum = randGen(1, 25) d. intNum =...
Which of the following statements enables the btnClear control? a. btnClear.Enabled() b. btnClear.Enabled = Yes c. btnClear.Enabled = True d. btnClear.Enable = True
In this exercise, you modify the Password application from this chapters Apply lesson. Use Windows to make a copy of the Password Solution folder. Rename the copy Modified Password Solution. Open the...
The strNames array contains 100 elements. Which of the following statements assigns the number 99 to the intLastSub variable? a. intLastSub = strNames.Length b. intLastSub = strNames.GetUpperBound(0)...
In this exercise, you modify the Password application from this chapters Apply lesson. Use Windows to make a copy of the Password Solution folder. Rename the copy Password Solution-Index. Open the...
Which of the following declares a two-dimensional array that has four rows and three columns? a. Dim decNums(2, 3) As Decimal b. Dim decNums(3, 4) As Decimal c. Dim decNums(3, 2) As Decimal d. Dim...
The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}. Which of the following blocks of code correctly calculates the average value stored in the array? The intTotal...
What must be done to text before it can be animated?
Write an HTML document to create a form that collects favorite popular songs, including the name of the song, the composer, and the performing artist or group. This document must call one PHP script...
Which of the following assigns the number 0 to each element in a two-row, four-column Integer array named intSums? a. For intRow As Integer = 0 To 1 For intCol As Integer = 0 To 3 intSums(intRow,...
Which of the following returns the highest column subscript in a two-dimensional array named decPays? a. decPays.GetUpperBound(1) b. decPays.GetUpperBound(0) c. decPays.GetUpperSubscript(0) d....
Explain why the callback function is written as an anonymous function in the request phase function.
How are beans used by JSP applications?
Consider the calculation of roots of an equation z N = where N 1 is an integer and = e j a nonzero complex number. (a) First verify that there are exactly N roots for this equation and that they...
The geometric series
Consider a signal x(t) = 4cos(2t) defined for < t < . For the following values of the sampling period T s generate a discretetime signal x(n) = x(nT s ) = x(t) t=nTs . (i) T s = 0.1, (ii) T s =...
While walking down a dark alley, Ben Bit diddle encounters a two input gate with the transfer function shown in Figure 1.48. The inputs are A and B and the output is Y. A Figure 1.48 Two-Input DC...
Build a 32-bit synchronous Up/Down counter. The inputs are Reset and Up. When Reset is 1, the outputs are all 0. Otherwise, when Up = 1, the circuit counts up, and when Up = 0, the circuit counts...
Write an HDL module for the soda machine dispenser from Exercise 3.26. Data from problem 3.26 You have been enlisted to design a soda machine dispenser for your department lounge. Sodas are partially...
Implement the following functions using a single 16 3 ROM. Use dot notation to indicate the ROM contents. (a) X = AB +BCD + AB (b) Y = AB +BD (c) Z = A +B+ C + D