Analyze the following algorithm s and provide its worst case

Assignment Help Computer Engineering
Reference no: EM132096064

Please help

Question 1

In computer science, a program is called ____ if it is impossible to solve it with a polynomial-time algorithm.

(A) intractable

(B) complex

(C) greedy

(D) transposable

When searching an array with 1,048,576 elements, how many comparisons will there be (at most) using binary search?

A) 8

B) 11

C) 21

D) 33

Which of the following problems has been proven not to have a polynomial-time solution?

A) Halting problem

B) chained matrix multiplication problem

C) sorting problem

D) shortest paths problem

Algorithms with time complexities such as n and 100n are called ____ algorithms.

A) linear-time

B) simple

C) first-order

D) one-to-one

It takes about ____ bits to encode a positive integer x in binary.

A) [lg x]

B) [lg x] + 1

C) x

D) x2

Question 2

Analyze the following algorithm S and provide its worst case time complexity measures.

Data is a global array of n elements of type keytype. Initial call to S is made:
S(0, n)

public static void S (index i, index j) {

index p;

if (j > i) {

p = subAlgoS (i, j);

S (i, p - 1);

S (p + 1, j);

}

}

public static void subAlgoS (index i, index j) {

index x, y, p;

keytype z;

z = Data[i];

y = i;

for (x = i + 1; x <= j; x++)

if (Data[x] < z) {

y++;

exchange Data[x] and Data[y];

}

p = y;

exchange Data[i] and Data[p];

return p;

}

Try to estimate average case performance and comment on the space complexity of the algorithm.

Question 3: Find the Big-Theta Complexity measures of the following recurrence relations:

T(n) = T(n/2) + 3n2 and T(1) = 5

T(n) = 4 T(n-1) + n4 + 2100 and T(1) = 100

Question 4: (20 points) Complete the following statements. Wherever applicable, assume the problem refers to which is a proper binary tree.

A tree T with 8 internal nodes will have __ external nodes, and __ total nodes.

The maximum number of external nodes in a tree with height of 5 will be __ and the maximum number of total nodes will be ____.

If a tree has 65 nodes altogether (i.e. total of internal and external nodes), its minimum and maximum height will be between min =___and max = ___.

Total number of nodes in a proper binary tree is always an (____ / odd) number.

If an expression tree contains 4 operators, it will contain_____ operands.

If an expression tree contains 4 operands, the number of possible expression tree topologies will be ______.

The height of the root node in a binary tree is ______.

Reference no: EM132096064

Questions Cloud

Technological and Strategical planning in New Ventures : Prepare a Mini Research project on the given topic. Topic: Technological and Strategical planning in New Ventures for solving Business start-up issues
Create a random sample of size 1000 from the diamonds data : Create a random sample of size 1000 from the diamonds data. Draw the scatterplot of carat vs log(price), color coded by cut.
Write the following functions for a linked list program : Write the following functions in C++ for a linked list program. Use separate .cpp main file for calling the functions to show they work.
Suggest a subset selection method and a shrinkage : Suggest a subset selection method and a shrinkage method that could be used here.
Analyze the following algorithm s and provide its worst case : When searching an array with 1,048,576 elements, how many comparisons will there be (at most) using binary search?
How many units on average while holding x2 constant : Suppose a multiple regression model is given by y = 4.44X1 -9.29X2 + 39.67. How do I determine what an interpretation of the coefficient of X1 be if X1
What are your thoughts about the intervention employed : What health state/health status and population resonated with you from the video - what was the primary determinant influencing their health state/health status
Create a main method and use these input files to test : Create a main method and use these input files to test that you are able to input the Undergraduates, put them into an ArrayList, print out the list.
Create an iterator that will allow the program to return : Create unique key values (Do not use map class from STD library.) Create an iterator that will allow the program to return the key,value pairs.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a void function definition for a function

Write a void function definition for a function called add_tax. The function add_tax has two formal parameters taxrate.

  What is sort order prescribed by ascii collating sequence

What is the sort order prescribed by the ASCII collating sequence? What are these commands presumed to do, and explain whether they will work at all.

  Discuss the information security or networking arena

I want help in writing my dissertation for MBA , I'm working in networking and security industry and I'm willing to have my dissertation to be.

  How to provide the name of the web site

For this project you will need to make a Microsoft Word document which includes a table and hyperlinks to Web sites helpful to someone studying in your major Paralegal.

  Threats resolved by redhat linux

The switches have the VLANs defined, one for the offices, one for the MIS, and one for the warehouse. Recognize what threats are resolved by the Redhat linux.

  Depiction of situation with flow chart

Physical goods are shipped back to supplier if they are discovered to be damaged upon arrival at the receiving warehouse.

  What mind-set does analyst need to work on such an approach

Could this be done differently, such as through JAD sessions or having the users review the program on a weekly basis. What mind-set does an analyst need to work on such an approach?

  Print the console pane of the mars simulator

Find the memory location and print the console pane of the MARS simulator.

  Create the logic that matche the master and transaction file

Create the logic for a program that matches the master and transaction file records, and outputs one line for each transaction, indicating job number.

  Program demonstrates simple symmetric-key encryption

This program demonstrates simple Symmetric-key Encryption using the XOR instruction with a multi-byte key entered by the user. Use this key to encrypt and decrypt the plain text

  Compare the two specifications from several points of view

Describe, in both an operational style and a descriptive style, the following problem. Compare the two specifications from several points of view.

  Write down the decimal equivalents for ieee floating point

Add the unsigned binary numbers then express the answer in decimal.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd