Analysis of Algorithms

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

For the following questions, please read this problem statement: A computer manufacturer must determine what product mix to produce. A server requires 4 CPU's and 8 Memory modules. A desktop computer requires 1 CPU and 4 Memory modules. Each server is sold for $1850 and each desktop is sold for $925. The manufacturer must produce a quantity of both units to keep both lines in production so the quantity of servers and desktops produced must both be greater than 0. The manufacturer can only get a supply of 1250 CPU's and 3800 memory modules due to shortages in the supply chain. Using the Simplex algorithm, determine the number of servers and desktops that should be built to maximize the profits of the manufacturer and determine how much revenue will be generated. Please enter a numerical answer only; do not enter any letters or words. If the answer is a dollar amount, please enter in the following format: $#,### How much Revenue (money in dollars received by selling the desktops and servers) will be generated?

$878,750.00

For the following questions, please read this problem statement: A computer manufacturer must determine what product mix to produce. A server requires 4 CPU's and 8 Memory modules. A desktop computer requires 1 CPU and 4 Memory modules. Each server is sold for $1850 and each desktop is sold for $925. The manufacturer must produce a quantity of both units to keep both lines in production so the quantity of servers and desktops produced must both be greater than 0. The manufacturer can only get a supply of 1250 CPU's and 3800 memory modules due to shortages in the supply chain. Using the Simplex algorithm, determine the number of servers and desktops that should be built to maximize the profits of the manufacturer and determine how much revenue will be generated. Please enter a numerical answer only; do not enter any letters or words. If the answer is a dollar amount, please enter in the following format: $#,### How many servers should be built?

150

Given the following algorithm, what is the number of fundamental instructions that this routine will execute if the value of n is 4? var M = A[ 0 ]; for ( var i = 0; i < n; ++i ) { if ( A[ i ] >= M ) { M = A[ i ]; } }

4+2n

For the following questions, please read this problem statement: A computer manufacturer must determine what product mix to produce. A server requires 4 CPU's and 8 Memory modules. A desktop computer requires 1 CPU and 4 Memory modules. Each server is sold for $1850 and each desktop is sold for $925. The manufacturer must produce a quantity of both units to keep both lines in production so the quantity of servers and desktops produced must both be greater than 0. The manufacturer can only get a supply of 1250 CPU's and 3800 memory modules due to shortages in the supply chain. Using the Simplex algorithm, determine the number of servers and desktops that should be built to maximize the profits of the manufacturer and determine how much revenue will be generated. Please enter a numerical answer only; do not enter any letters or words. If the answer is a dollar amount, please enter in the following format: $#,### How many Desktop computers should be built?

650

True or False: Circuit Satisfiability is not a representation for a NP-hard problem as it can be solved in O(n2) time.

False

True/False: A Boolean variable can take on only 1 value.

False

True/False: A graph with edges that have no directional indication as in the following diagram is called a uni-directed graph.

False

True/False: An algorithm is a well-defined sequence of steps used to solve a well-defined problem in an infinite number of steps.

False

True/False: Dijkstra's algorithm finds the shortest paths in a graph from all vertices to a given vertex.

False

True/False: Dynamic programming is a variation of the linear programming model in that it breaks the problem down into smaller problems that are solved using the simplex method?

False

True/False: Dynamic programming is less complex asymptotically but is substantially more complex from a programming perspective?

False

True/False: In a linear programming problem there can be no more than 3 constraints:

False

True/False: In linear programming a constraint must be represented as a inequality.

False

True/False: In linear programming, either the constraints or the optimization criteria must be linear functions.

False

True/False: Is 2^(n+1) = O(2^n) ?

False

True/False: Let T be a minimum spanning tree of G. Then, for any pair of vertices s and t, the shortest path from s to T is G is the path from s to t in T

False

True/False: Linear programming is an excellent approach for optimization problems where the objective function graphs as a curvilinear line.

False

True/False: NP is the set of decision problems that can be solved in polynomial time.

False

What is the big-o complexity of the red line? (the flat line)

O(1)

3^n + 12

O(2^n)

What is the big-o complexity of the second line on the left?

O(2^n)

______ is the time complexity of an algorithm that operates in exponential time. This means that process times doubles with the addition of each data element.

O(2^n)

What is the Asymptotic complexity of a binary search given the code below and the following recursion equation: T(n) = T(n/2) + 1 // initially called with low = 0, high = N - 1 BinarySearch_Right(A[0..N-1], value, low, high) { // invariants: value >= A[i] for all i < low value < A[i] for all i > high if (high < low) return low mid = (low + high) / 2 if (A[mid] > value) return BinarySearch_Right(A, value, low, mid-1) else return BinarySearch_Right(A, value, mid+1, high) }

O(lg * n)

What is the big-o complexity of the green line? (third line to the right)

O(n log n)

What will be the Big-Oh complexity of a linear search?

O(n)

_____ is the time complexity of an algorithm that operates in linear time. The process time changes in the same ratio as the data size.

O(n)

What is the Big-Oh complexity of the selection sort?

O(n^2)

What is the big-o complexity of the purple line? (third line to the left)

O(n²)

The Knapsack, Minimum Spanning Tree, Shortest Path, and Traveling Salesperson are all what kind of problem from an algorithms perspective?

Search

True or False: All P problems are included in the set of problems that are considered to be NP (nondeterministic polynomial).

True

True or False: NP-complete problems are a subset that is the intersection between NP problems and NP-Hard problems.

True

True or False: The Cook-Levin Theorem states that Circuit satisfiability is NP-complete.

True

True/False: A graph is a set of vertices and a set of edges such that each edge is a connection between a pair of vertices.

True

True/False: A graph with numbers or letters on the vertices is called a labeled graph.

True

True/False: A reduction is solving problem A using problem B where an algorithm for B exists (for example redefining an optimization problem as a search problem).

True

True/False: According to our reading assignments, circuit satisfiability is a good example of a problem that we don't know how to solve in polynomial time.

True

True/False: Amortized analysis allows for the establishment of a worst-case bound for the performance of an algorithm irrespective of the inputs by looking at all of the operations.

True

True/False: An algorithm is a well-defined sequence of steps used to solve a well-defined problem in finite time.

True

True/False: Dynamic Programming reduces asymptotic complexity by eliminating redundant computations.

True

True/False: In a dynamic programming algorithm, we can use a table to store results of sub-problems and then refer to this table to ensure that we don't recomputed those sub-problems.

True

True/False: Linear programming is used primarily to solve problems of optimization?

True

True/False: O(1) is the time complexity of an algorithm that operates in constant time. The process time required stays constant regardless of the data size.

True

True/False: Recursive routines cannot be used in Dynamic Programming algorithms?

True

True/False: The Simplex method is important for computer programming, as the need for processing power is significantly lower when using it as opposed to other methods.

True

True/False: The backtracking algorithm treats the solution space as a graph and follows a path to conclusion to find a solution to a problem. The algorithm may 'backtrack' by reversing up to previous branches in a tree and try all branches to find the solution.

True

True/False: The running time of an algorithm is the number of instructions it executes when run on a particular instance.

True

A process that is designed to visit every vertex in a graph is known as a: a. Graph traversal b. Graph search c. Binary search d. Enumeration

a

According to the Cook-Levin Theorem, Circuit satisfiability is: a. NP-Complete b. NP-Hard c. NP-Easy d. P

a

Consider the following figure. What does the region that is shaded represent? a. The Feasible region b. The Infeasible solutions c. The optimal solution d. The Constraint Space

a

Linear programming problems can be solved using which of the following: a. Simplex method Correct b. Quick method c. Stochastic method d. None of these answers

a

The Backtracking algorithm implements what search? a. Depth First Search b. Sequential search c. Breadth First Search d. Binary Search

a

What does point #4 represent? a. The optimal solution b. An infeasible solution c. An Alternate vertex d. None of these answers

a

What will be the Big-Oh complexity to traverse a linked list? a. O(n) b. O(1) c. O(n2) d. O(2n)

a

When using the simplex method, what is the name of item on the left hand corner (after the p?) a. Pivot column b. The Vertex c. Objective Value d. Optimal point

a

Breadth first search __________. a. Scans each incident node along with its children. b. Scans all incident edges before moving to other node. Correct c. Is same as backtracking. d. Scans all the nodes in random order. e. Scans all the nodes in pre-order manner.

b

In a linear programming problem, a statement such as max x1 + 6x2 represents: a. A constraint function b. The Objective function c. The maximization function Incorrect d. The feasible function

b

In the following graph what do the circles represent? a. Edges b. Vertices c. Nodes d. Cycles

b

True/False: A graph with edges that point in such a way that one could follow such directed edges and visit the same vertex again, as is illustrated in the following diagram is a graph that is said to have or be: a. Directed b. Cyclic or cycles c. Free tree d. Acyclic

b

What term best describes this graph? (graph with no arrows, just lines) a. Directed Graph b. Undirected Graph c. Tree d. Directed Acyclic Graph

b

What will be the Big-Oh complexity to search a balanced binary tree? a. O(n) b. O(log n) c. O(n2) d. O(2n)

b

Which method of traversal does not use stack to hold nodes that are waiting to be processed? a. Depth First b. Breadth first c. Back-tracking d. Bounding

b

If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed? a. ABCD b. ABDC c. DCAB d. DCBA e. ACDB

c

The Class of P problems are (select the best answer): a. Problems that can all be solved quickly in O(n) time. b. Are not included in the set of NP problems. c. The set of problems that can be solved in polynomial time. d. All of these responses.

c

Which of the following is NOT a P (polynomial), easy problem?

c

Consider: A farmer can plant up to 8 acres of land with wheat and barley. He can earn $5,000 for every acre he plants with wheat and $3,000 for every acre he plants with barley. His use of a necessary pesticide is limited by federal regulations to 10 gallons for his entire 8 acres. Wheat requires 2 gallons of pesticide for every acre planted and barley requires just 1 gallon per acre. Problem: What is the maximum profit he can make? Assumptions: let x = the number of acres of wheat and let y = the number of acres of barley. Which of the following is a valid constraint for this problem? a. y <= 8 - 2x b. x <= 0 c. x <= 8-x d. y <= 10 - 2x

d

In a linear programming problem assuming the Simplex Method the following is known as: a. The Constraints Incorrect b. The Solution definition c. The Problem definition d. The Tableau

d

Suppose you have a directed graph representing all the flights that an airline flies and the flying times for each connection. What algorithm might be used to find the best sequence of connections from one city to another to minimize the overall time of the flight? a. Breadth first search. b. Depth first search. c. A cycle-finding algorithm. d. A shortest-path algorithm.

d

What term best describes this graph? (graph with arrows, no lines) a. Directed Graph b. Undirected Graph c. Tree d. Directed Acyclic Graph

d

Which of the following is NOT a property of logarithms? a. log(nm) = log n + log m b. log(n/m) = log n - log m c. log (n^r)= r log n d. log(b) n= log(n)b log(a)b

d

Which of the following is NOT an NP-Complete, Hard problem? a. Traveling Salesman Problem b. Knapsack c. Integer Linear Programming d. Minimum Spanning Tree

d

Which of the following is NOT one of the main principles of dynamic programming algorithms? a. Optimal substructure: optimal solutions to problems are built from optimal solutions to subproblems. b. "Shop around": to determine the best op tion, try them all and select the best one. Do not employ heuristics. c. Memorization: answers to subproblems are remembered to avoid repeated computation of the same thing. d. Recursion: implemented as a recursive routine to reduce overhead and improve computational efficiency.

d

Which of the following is NOT one of the steps used in a Divide-and-conquer algorithm to solve a problem? a. Breaking the problem into subproblems that are themselves smaller instances of the same type of problem b. Recursively solving the subproblems c. Appropriately combining the answers of the solved subproblems d. Exhaustively searching every potential path of the problem to identify all solution candidates

d


Kaugnay na mga set ng pag-aaral

Exam 1 Health Psychology Chapters 1 - 5

View Set

ATI NurseLogic 2.0 Testing and Remediation

View Set

APUSH Short Answer Questions- Chapters 1 and 2

View Set