Computer Science Homework Solutions

Algorithm Problem

Analyze each of the following statements to indicate whether the statement is true or false, respectively. If the statement is correct, briefly state why. If the statement is wrong, correct it. Please elaborate on your justification or correction, but be brief. One-sentence explanations should suffice. T F For any asy ...continues

Show that "q^2 + (n-q-1)^2" achieves a maximum over q = 0, 1, ..., n-1 when q = 0 or q = n-1.

Show that "q^2 + (n-q-1)^2" achieves a maximum over q = 0, 1, ..., n-1 when q = 0 or q = n-1.

Obtain asymptotically tight bounds on lg(n!) without using Stirling's approximation.

Obtain asymptotically tight bounds (Big-Oh and Big-Omega) on lg(n!) without using Stirling's approximation. Instead, evaluate these using the expansion of lg(n!) as a summation.

Algorithm Problem

Argue briefly that to test whether a given n-element permutation can be sorted by an n-input comparison network, it suffices to test the network on n—1 sequences of 0’s and 1’s.

What is the effect of calling HEAPIFY(A, i) when the element A[i] is larger than its children?

Consider the following definition of HEAPIFY. HEAPIFY(A, i) 1 l = LEFT(i) 2 r = RIGHT(i) 3 if l < heap-size[A] and A[l] > A[i] 4 then largest = l 5 else largest = i 6 if r < heap-size[A] and A[r] > A[largest] 7 then largest = r 8 if largest != i 9 then exchange A[i] and A[largest] 10 ...continues

C#

Programming Concepts for Engineers. See attached file for full problem description.

For the Class

For the Class "date," give examples of: Objects (instances), Instance Variables, Methods, Messages, Interfaces, Encapsulation, Inheritance, and Polymorphism.

C#

Please see attachment. All log or txt files needed are attached

C program

You will write a program to calculate the exam grades for a class of a few hundred students. Input Read the input file into your program as a comand line argument, rather than hardcoding the name as you were allowed to in project 3. Each student has a last name, first name, and five problem scores (the four problems on th ...continues

Analyse combinational arithmetic circuits that compute the sum of n k-bit numbers.

The sum of n k-bit numbers can be computed by a combinational arithmetic circuit as follows. Assume that n is an exact power of 2. The circuit consists of a complete binary tree of ripple-carry adders, in which each node in the tree adds two numbers and produces a sum which is fed to its parent. The n/2 leaves of the tree inp ...continues

Browse