Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Q1. Analysis of algorithms: For each expression in the leN column, give the best matching description from the right column.

______N3

______1 + 2 + 3 + 4 + 5 + : : : + N                                         A. 1/2N2.

______1/2N2 + 100NlgN                                                          B. O(N2).

______1/2N2                                                                          C. Both A and B.

______2 + 4 + 6 + 8 + 10 + : : : +N                                        D. Neither A nor B.

______N2

______1 + 2 + 4 + 8 + 16 + : : : + N

Q2. For each quantity in the left column, give the best matching description from the right column.

______Height of a weighted quick union data structure with Nitems.                                 A. lgN in the best case.

______Height of a binary heap with N keys.                                                                   B. lgN in the worst case.

______Height of a left-leaning red-black BST with Nkeys.                                                C. Both A and B.

______Maximum function-call stack size when (top-down) merge sorting N keys.               D. Neither A norB.

______Maximum function-call stack size when quick sorting Nkeys.

______Number of compares to binary search a sorted array of sizeN.

Q3. Consider the following code fragment.

int count = 0;

int N = a.length;

Arrays.sort(a);

for (int i = 0; i < N; i++) {

for (int j = i+1; j < N; j++) {

if (Arrays.binarySearch(a, a[i] + a[j])) count++;

}

}

Suppose that it takes 1.5 second when N = 3,500. Approximately how long will it take when N = 35,000? Select the best answer:

15 seconds         

30 seconds         

1.5 minute         

30 minutes         

1.5 hours            

4.5 hours

Q4. Ordered-array implementation of a set.

Suppose you implement the set data type using an ordered array. That is, you maintain the N keys in the set in ascending order in an array.

What is the order of growth of the worst-case running time of each of the operations below? Write down the best answer in the space provided using one of the following possibilities.

1              logN       sqrt(N) N             NlogN                   N2

function

description

performance

add(key)

add the key to the set

 

contains(key)

is the key in the set?

 

ceiling(key)

smallest key in the set >= key

 

 

rank(key)

nume of keys in set smaller than given key

 

select(i)

ith largest key in the set

 

min()

smallest key in the set

 

delete(key)

delete the given key from the set

 

iterator()

iterate over all N keys in order

 

Q5. Red-black trees

Consider the following left-leaning red-black tree. Add the key Z, then add the key P

1539_Figure.png

(a) Draw the resulting left-leaning red-black tree.

(b) How many left rotations, right rotations, and color flips are performed in total to insert the two keys?

______left rotation(s)                  ______right rotation(s)                                ______color flip(s)

Q6. Hashing

Suppose that the following keys are inserted in some order into an initially empty linear- probing hash table of size 7, using the following table of hash values:

key hash

key hash

A

3

B

1

C

4

D

1

E

5

F

2

G

5

Which of the following could be the contents of the linear-probing array?

I.

0

1

2

3

4

5

6

G

B

D

F

A

C

E

II.

0

1

2

3

4

5

6

B

G

D

F

A

C

E

III.

0

1

2

3

4

5

6

E

G

F

A

B

C

D

Select the best answer.

(a) I only.

(b) I and II only.

(c) I and III only.

(d) I, II and III.

(e) None.

Q7. Hard problem identification.

You are applying for a job at a new software technology company. Your interviewer asks you to identify the following tasks as easy (E) or impossible (I).

______ Build a balanced BST containing N keys using 8N compares (where the array of keys are given to you in ascending order).

______ Build a balanced BST containing N keys using 8N compares (where the array of keys are given to you in arbitrary order).

______ Build a binary heap containing N keys using 2N compares (where the array of keys are given to you in arbitrary order).

______Build a BST containing N keys that has height at most 1/2lgN.

______Design a priority queue that does insert and delete-max in lg lgN compares per operation, where N is the number of items in the data structure.

Q8. Minimum spanning trees

Consider the following edge-weighted graph with 9 vertices and 19 edges. Note that the edge weights are distinct integers between 1 and 19.

1468_Figure1.png

(a) Complete the sequence of edges in the MST in the order that Kruskal's algorithm includes them (by specifying their edge weights).

(b) Complete the sequence of edges in the MST in the order that Prim's algorithm includes them (by specifying their edge weights).

Q9. Discuss the dramatic effect that algorithm choice can have on performance by giving example algorithms with markedly different performance characteristics when used to solve the same problem. Describe any theoretical or empirical performance results regarding the problems/algorithms you discuss.

Q10. Is the Partition problem in P or NP? Provide an argument that demonstrates your answer.

Q11. Define Big-O, Big-Theta, and Big-Omega. Describe the differences among them. Define the ~ notation and describe the key differences between it and the other three formalisms.

Q12. Define "loitering" Explain why it can matter. Give an example of code where loitering might occur and detail the changes necessary to prevent it.

Attachment:- Assignment.rar

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92064925

Have any Question?


Related Questions in Computer Engineering

A firm faces the following inverse demand curvep

A firm faces the following inverse demand curve P= 54-0.5Q Where P is the price of output and Q is the number of outputs sold per hour. This firm is the only employer in town and faces an hourly supply of labor given by: ...

Question the below table shows the instruction count ic for

Question : The below table shows the instruction count (IC) for programs running on three processors P1, P2, and P3 with the clock rates 1.0 GHz, 2.5 GHZ, and 2.0 GHz respectively. Each program consists of only Load/stor ...

In statistics the mode of a set of values is the value that

In statistics, the mode of a set of values is the value that occurs most often or with the greatest frequency. Write a function that accepts as arguments the following: A. An array of integers B. An integer that indicate ...

This is a chemistry question regarding physical and

This is a chemistry question regarding physical and chemical changes. The question is the following: You mix 3 liquids and the resulting solution becomes very hot. A short time later bubbles began to form. There is a che ...

Question bull studentssidnameagegpabull coursesciddeptid

Question : • students(sid,name,age,gpa) • courses(cid,deptid, description) • professors(ssn,name,address,phone,deptid) • enrollment(sid,cid,section • teaches(cid,section,grade). cid makes reference to the courses table. ...

Question subject digital securitybriefly explain how

Question : Subject: Digital security Briefly explain how Android 3.0 and later versions encrypt file and user data, and how encryption keys are derived. The response must be typed, single spaced, must be in times new rom ...

A compare the properties of cpu registers with the main

(a) Compare the properties of CPU registers with the main memory in MIPS.  (b) Describe the purpose of the stack pointer ($sp) for procedure calling. (c) What is a "basic block" and how is it used by a compiler? (d) Ther ...

An equally weighted portfolio consists of 64 assets which

An equally weighted portfolio consists of 64 assets which all have a standard deviation of 0.276. The average covariance between the assets is 0.106. Compute the standard deviation of this portfolio. Please enter your an ...

You get hired as a machine learning expert at moviescom

You get hired as a Machine learning expert at movies.com. Your task on day one is to improve the performance of a classifier. You divide the data into 2 parts training, and testing. You learn a model from the training da ...

On a string s we have the following elementary operations i

On a string s, we have the following elementary operations: i) Insertion of a single letter into the string s, e.g., BT ? BAT. ii) Deletion of a single letter in the string s, e.g., CAT E ? CAT. iii) Substitution of one ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As