Computer Science Homework Solutions

Describe an efficient algorithm to determine the depth of a comparison network with given representation.

Mr. Johnson draws an n-input comparison network with m comparators according to the following conventions. The lines of the network go left-to-right, and comparators are drawn vertically to connect two lines. The network is drawn on an underlying grid, so that each comparator occupies one of at most m columns. Comparators can ...continues

Describe and analyze EREW parallel random-access machine algorithms for the given problems.

Analyze your algorithm in each of the following cases. [a] Consider an n-element list in an n-processor EREW parallel random-access machine, where some elements of the list are marked as being blue. Describe an efficient parallel algorithm to form a new list consisting of all the blue elements. [b] Suppose that some nodes ...continues

BFS, DFS, DAGs, Topological sorting, and Dijkstra

What are the feature differences/tradeoff between Breath First search(BFS), Depth-Fisrt-Search(DFS), Directed Acyclic Graphs(DAGs), Topological sorting and Dijkstra?

Java method with Multiple parameters

This is about methods with multiple parameters: Could you explain to me (in very simple terms) how methods with multiple parameters are declared? If possible, could you provide two short examples? I just need to get a head-start so I can implement this to my assignment if it comes up.

Programming Problems

Most programming languages do not allow you to ask two or more questions in a single comparison by using a logical And Operator Most programming languages allow you to ask two or more questions in a single comparison by using logical OR operator In an AND situation, first ask the question that is more likely to be true. ...continues

Convert given flowchart into pseudocode.

Write the pseudo code for the attached flowchart that adds a series of user-entered numbers and terminates after displaying the sum when the user enters 0.

Algorithm Problems

Algorithm Problems. See attached file for full problem description.

Array of Spices in Java

If I were to describe an every day situation, like being a chef at a restaurant, how would I implement an array (for inventory) of my spices (I would have a total of 20 spice bottles)? And, how would items in the array might be searched for or sorted? I don't need a full program, I just need pseudocode - a small example of ju ...continues

Describe how the use of primitives helps remove ambiguities in an algorithm’s representation.

Describe how the use of primitives helps remove ambiguities in an algorithm’s representation.

Please modify this program so the application can handle multiple items.

Please modify this program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. ...continues

Browse