Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA 3. PLEASE ANSWER ALL QUESTIONS! I WILL LEAVE A BIG LIKE AND COMMENT AS LIFE

ID: 3702824 • Letter: J

Question

JAVA 3. PLEASE ANSWER ALL QUESTIONS! I WILL LEAVE A BIG LIKE AND COMMENT AS LIFESAVER!!!

Question 1

In the makeRoom(newPosition) method of an array-based implementation of the ADT list no shift is necessary if newPosition is equal to

Options:

numberOfEntries – 1

numberOfEntries

numberOfEntries +1

none of the above

Ans: ?

2)In a circular array based implementation if a queue what is the performance when the enqueue operation if you amortize the cost id resizing the array over all additions to the

A. O(1)

B.O(n)

C.O(logn)

D.O(n2)

Ans: ?

3)when a counter enumerates simulated time units. It is called a(n)

A. All other answers

B.time driven simulation

C.event drivem simulation

D.clock simulation

Ans: ?

4)The radix sort

A. Treats array entries asif they were strings that have same length

B. Is not suitable as a general purpose sorting algorithm

C.restrcits the data that it sorts on

D. All other answers

Ans: ?

5)Which of the following statements are true about quick sort

A. It can degrade into an O(n2) sort if the pivot selection scheme is bad

B. It doesnt require additional memory that merges sort does

C. All other answers

D.in practice it can be transfer than merge sort

Ans: ?

Explanation / Answer

Answer 1

If the position to be inserted is between 0 and less than maximum size of the array no shifting is required. hence the answer is numberOfEntries - 1

answer 3:

Option B. Time driven simulation is the answer. Time driven simulation first initializes the system state and simulation time and then it increments the simulation time until simulation is not finished

answer 4:

Radix sort is mainly used to sort integers. But since alphabets anand floats have an integer value this algorirhm can be used as a general purpose one. But it treats input value as a string of digits, so we can call it as a string sorting algorithm. Hence the answer is option A. Treats array entries as if they were strings that have the same length.

answer 5:

If the pivot selection scheme.is bad the worst case complexity for quick sort is O(n2). also quick sort doesn't require additional memory like merge sort. But we can't say quick sort is faster than merge sort always, meaning that quick sort is comparable in speed to merge sort for small inputs but, as the size of the input data grows, the fact that its complexity is quadratic will become evident and quick sort becomes slow. So the answer is option C. All of the above ( a and b are true)