Explore BrainMass


CLS on heads or tails program

I also need to fill in the missing part of the code In MS-DOS, the command to clear the screen is cls; in UNIX, it is clear. Try the command so that you understand its effect. Modify the heads_or_tails program so that the screen is cleared at the beginning of the program. Use the function call system ("cls") or system ("clear")

Algorithms - Design and Analysis Fundamentals

A. Design a recursive algorithm whose input is a decimal integer and whose output is the binary representation of the input. b. Design a recursive algorithm that computes the reverse of the result in (a) - that is, converts a binary integer to its decimal equivalent.


Trace the action of the algorithm NaiveGCD for the following input pairs. a. (24,108) b. (23,108) c. (89,144) d. (1953,1937) Exercise 1.8: Repeat Exercise 1.7 for the algorithm EuclidGCD.


For a general positive integer n, show that the left-to-right binary method for computing requires between log2n and 2log2n multiplications. Textbook: Algorithms: Sequential, Parallel, and Distributed

Rows in a Query

If you had two tables, each with 3 items: Table_Mike: ITEM: Bread Milk Eggs Table_Kristy: ITEM: Cereal Butter Eggs And performed a UNION, how many rows would the resulting query have?

Disk Tracks Traversed Using Algorithms

Calculate and compare the number of disk tracks traversed using FCFS, SSTF, SCAN, and LOOK algorithms for the series of disk track service requests given below. At the time the first request arrives in the disk request queue, the read/write head is at track 50, moving toward the outer (lower-numbered) tracks. (Hint: Each track o


Probabilities 1.) A taxicab was involved in a fatal hit-and-run accident at night. Two cab companies, The Green and The Blue, operate in the city. You are told that: ? 85% of the cabs in the city are Green and 15% are Blue ? A witness identified the cab as Blue The court tested the reliability of the witness under the same c

Dijkstra?s Shortest Path Algorithm

Consider the following network. a) With the indicated link costs, use Dijkstra?s shortest path algorithm to compute the shortest path from E to all network nodes. Show how the algorithm works by computing a table. b) Eliminate node A, and redo the problem starting from node B. Please refer to the attachment to view the

Automata and Computability

Describe the error in the following fallacious "proof" that P  NP. Consider an algorithm for SAT: "On input , try all possible assignments to the variables. Accept if any satisfy ." This algorithm clearly requires exponential time. Thus SAT has exponential time complexity. Therefore SAT is not in P.

Create an expense report for a company's sales force

Create an expense report for a company's sales force, then save it. To view these instructions while you work in Excel, do either of the following: Print this page of instructions or move back and forth between this page and Excel by clicking each application's button on the Windows taskbar Retrieve Expense Report, save it o

Payroll Swing Applet - CalcPay

Create a payroll Swing applet named CalcPay that allows the user to enter two double values?hours worked, and an hourly rate. When the user clicks a JButton, gross pay is calculated. There is another JButton for clicking so that federal withholding tax is subtracted from gross pay based on the following table: Income $

Relative Speed of Ripple Carry Adders

Calculate the relative speed of a 64-bit adder using ripple carry only, a ripple carry of 4-bit groups that use carry lookahead, and a ripple carry of 16-bit groups that use carry lookahead. Use the simulator located at the following url: Also explain, what is relative spee

Output for values

4. Consider the following program in Pascal with static scope: program main (input, output); var i, j, k, m: integer; procedure Q (var i: integer; m: integer); begin i := j + 1; m := k + 1; writeln (i, j, k, m); end procedure P(var i: integer; j: integer); var k: integer; procedure S(i: integer) begin i := k + 3; m

Bitwise sum

Write a C program that prompts user for two integers and then prints the sum of the wo numbers. Please dont use any arthemetic opoerators anywhere. just bitwise-and, bitwise-or bitwise-xor, <<(left shift) and >>(right shift)

function that prints the average for each student in class

#define CLASS_SIZE struct student{ chair*last-name: int studrent_id: char grade: }; in another file we write #include"cl_info.h" int main (void) { struct student temp, class[CLASS_SIZE}; ....... assign values to members temp.grade="A" temp.last_name="Bushker"; temp.student_id=590017;

Primary and Foreign Keys

Please tell me which one is primary key and which one is foreign key in each situation (1-1, 1-many, many-1). In () are keys but I need to know which one is primary and foreign keys. If there's no foreign keys, pls. give one foreign key each for the situation. Thank you in advance. 1. One-to-One: Man (man_name, man_age, man_

Thread Synchronization

C program that runs under cygwin which again declares three pthreads. The main program prompts the user for the values x, y, z all integers. It then starts the threads. Thread1 calculates the average of x, y and z and puts the value into a shared variable w. Thread2 calculates the product and puts the value into v. Th


C program that creates three pthreads, each of which executes a different slave process. The first slave prompts the user for two integers x and n and the uses a loop to calculate xn and outputs the result. The second slave outputs the phrase "Hello from slave 2" ten times inside the nested for loops For(I=0; i<10

E-R Diagram

Assume that at XYZ company each product (described by Product No., Description, and Cost) is comprised of at least three components (described by Component No., Description, and Unit of Measure) and components are used to make one or many products (that is, must be used in at least one product). In addition, assume that componen

Arithmetic for Computers

1. Show unique examples of binary arithmetic operations (addition and subtraction) using two's complement. 2. Show unique examples of logical manipulation of binary numbers using AND, OR, and NOT (complement). 3. Show unique examples of bit shifting of binary numbers. Remember to cite your sources!

DB: Using Word, Travel Tips 3

You will use the Travel Tips 3 document and add a table, a bulleted list, and a page border. To view these instructions while you work in Word, do either of the following: Print this page of instructions. Move back and forth between this page and Word by clicking each application's button on the Windows taskbar. Open the