# CS代写：Exam 代考COMP2521，90+通过

100%硕博原创

100%高分保障

1v1视频沟通学霸

## Programming COMP2521 90分代考案例

Question 1

An algorithm solves a problem of size nn recursively by breaking it down into two subproblems of size n/2n/2 with the same structure, until the size of a subproblem is one or zero. It takes O(1)O(1) time to solve a (sub)problem of size one or zero. It takes O(n)O(n) time to convert a problem of size nn into two subproblems and it takes O(n)O(n) time to combine the results of these subproblems into the result of the problem of size nn. What is the time complexity of this algorithm? Justify your answer.

Submission

Submit via the give command

give cs2521 sample_exam_q1 q1.txt

Question 2

Consider the following algorithm, which converts a positive integer nn to its binary representation.

BinaryConversion:

Input  positive integer n

Output binary representation of n on a stack

create empty stack S

while n > 0 do

push (n mod 2) onto S

n = floor(n / 2)

end while

return S

What is the time complexity of the algorithm? Assume that creating a stack and pushing an element onto a stack are both O(1)O(1) operations (i.e., constant). Justify your answer.

Submission

Submit via the give command

give cs2521 sample_exam_q2 q2.txt

Question 3

Consider the the following 2-3-4 tree :

(a) What value(s) would be stored in the root node of the above 2-3-4 tree after the insertion of the value 8? What value(s) would be stored in the node that now contains 8? Note: if you need to promote a value, you must promote the smaller of the two middle values. Justify your answer.

(b) What value(s) would be stored in the root node of the above 2-3-4 tree after the insertion of the value 50? What value(s) would be stored in the node that now contains 50? Note: if you need to promote a value, you must promote the smaller of the two middle values. Justify your answer.

Submission

Submit via the give command

give cs2521 sample_exam_q3 q3.txt

Question 4

Consider the following trie. Finishing nodes are shown in red.

a) How many words are stored in this trie?

(b) Which nodes would be visited in searching for “deeds”?

(c) What new nodes would be created if the word “bogus” was added to the trie? Justify your answer.

(d) What new nodes would be created if the word “do” was added to the trie? Justify your answer.

Submission

Submit via the give command

give cs2521 sample_exam_q4 q4.txt

Question 5

(a) What is the difference between an Euler path and a Hamilton path?

(b) Does the graph below have any Euler paths? If so, give one of them. If not, explain why.

(c) Does the graph below have any Hamilton paths? If so, give one of them. If not, explain why.

Submission

Submit via the give command

give cs2521 sample_exam_q5 q5.txt

Question 6

This question is about the array-based implementation of a max heap.

(a) Suppose the original state of the heap is:

[0]  [1]  [2]  [3]  [4]  [5]  [6]  [7]  [8]  [9]

—   Q    N    H    D    K    E   —  —  —

Show the state of the heap after performing each of the following operations:

join(pq, S)

join(pq, P)

Note that the “join(pq, P)” operation should be performed on the state of the heap obtained after performing the “join(pq, S)” operation.

(b) Suppose the original state of the heap is:

[0]  [1]  [2]  [3]  [4]  [5]  [6]  [7]  [8]  [9]

—   Q    N    H    D    K    E   —  —  —

Show the state of the heap after performing each of the following operations. What are the values of it1 and it2?

it1 = leave(pq)

it2 = leave(pq)

Note that the “it2 = leave(pq)” operation should be performed on the state of the heap obtained after performing the “it1 = leave(pq)” operation.

Submission

Submit via the give command

give cs2521 sample_exam_q6 q6.txt

Question 7

Consider a hash table of integer keys with 11 slots and a primary hash function of h(k)=k % 11h(k)=k % 11.

Consider the following sequence of values:

10, 12, 28, 35, 25, 32, 20, 17, 24, 39

(a) Suppose the hash table described above uses linear probing for collision resolution. Show the final contents of the hash table after the values above have been inserted into an initially empty table in the order given. Give the cost, in terms of the number of keys examined, when searching for the key value 6 in the resulting table.

(b) Suppose the hash table described above uses double hashing for collision resolution, with a secondary hash function of h2(k)=1+(k % 5)h2(k)=1+(k % 5). Show the final contents of the hash table after the values above have been inserted into an initially empty table in the order given. Give the cost, in terms of the number of keys examined, when searching for the key value 6 in the resulting table.

Submission

Submit via the give commandgive cs2521 sample_exam_q7 q7.txt

## Recent Case

### Java作业代写 最靠谱的Java作业代写 Java代写：100%原创代码，80分以下全额退款，专业CS代写团队

Java作业代写 最靠谱的Java作业代写 Jav

### Java代做 最靠谱的Java代做 Java代写：100%原创代码，80分以下全额退款，专业CS代写团队

Java代做 最靠谱的Java代做 Java代写：

## Service Scope

C|C++|Java|Python|Matlab|Android|Jsp|Prolo