Question: QUESTION 6 The worst-time complexity for selection sort is ________. O(1) O(logn) O(n) O(nlong) O(n*n) QUESTION 9 In the implementation of MyLinkedList, last.next is always

QUESTION 6

The worst-time complexity for selection sort is ________.

O(1)

O(logn)

O(n)

O(nlong)

O(n*n)

QUESTION 9

In the implementation of MyLinkedList, last.next is always null.

True

False

QUESTION 10

In the implementation of MyArrayList, capacity is the length of the array used to store the elements in the list.

True

False

QUESTION 11

O(n*n) is ________.

constant time

logarithmic time

linear time

log-linear time

quadratic time

QUESTION 13

In the implementation of MyLinkedList, Node is defined as a static inner class inside MyLinkedList because it does not reference any instance data fields in MyLinkedList.

True

False

QUESTION 15

A heap is a full binary tree.

True

False

QUESTION 17

The time complexity for the Euclid's algorithm is ________.

O(n)

O(n^2)

O(logn)

O(2^n)

QUESTION 20

The worst-time complexity for linear search is ________.

O(1)

O(logn)

O(n)

O(nlong)

O(n*n)

QUESTION 21

In the implementation of MyLinkedList, Node has a property named element that stores an element.

True

False

QUESTION 23

MyArrayList and MyLinkedList are two concrete implementations of MyList.

True

False

QUESTION 24

In the implementation of MyArrayList, capacity is reduced by 1 if an element is deleted from the list.

True

False

QUESTION 25

The following complexity is O(nlogn):

n*n*n + nlogn

True

False

QUESTION 26

Average-case time complexity analysis is ideal, but difficult to perform, because it is hard to determine the relative probabilities and distributions of various input instances for many problems.

True

False

QUESTION 27

Given an algorithm, estimating algorithm efficiency is to measure the algorithm's actual execution time.

True

False

QUESTION 29

Given a heap, to remove the root, you need to start a process by first placing the larger child of the root to the place of the root and move it down to maintain the heap property.

True

False

QUESTION 30

Time complexity analysis is often for the worst case, since you can show that the algorithm will never be slower than the worst-case.

True

False

QUESTION 31

In the implementation of MyArrayList, size indicates the number of elements in the list.

True

False

QUESTION 34

MyArrayList is implemented using an array, where the array is dynamically created, and if the capacity of the array is exceeded, create a new larger array and copy all the elements from the current array to the new array.

True

False

QUESTION 35

The following complexity is O(nlogn):

23nlogn + 50

True

False

QUESTION 36

ArrayList is more efficient than LinkedList, when inserting/deleting an element in the middle of the list.

True

False

QUESTION 38

In the implementation of MyLinkedList, if a linked list is empty, first is null and last is null.

True

False

QUESTION 39

In the implementation of MyLinkedList, Node is defined as an inner class inside MyLinkedList.

True

False

QUESTION 42

A queue can be viewed as a special type of list, where the elements are inserted into the end (tail) of the queue, and are accessed and deleted from the beginning (head) of the queue.

True

False

QUESTION 43

The time complexity for finding an element in a binary search tree is ________.

O(1)

O(logn)

O(n)

O(nlogn)

QUESTION 44

The worst-time complexity for binary search is ________.

O(1)

O(logn)

O(n)

QUESTION 47

In the implementation of MyQueue, MyQueue contains a linked list for storing elements.

True

False

QUESTION 48

To add a new node to a heap, you need to start a process by first placing it as the left child of the root and move it up to maintain the heap property.

True

False

QUESTION 49

Given a heap, to remove the root, you need to start a process by first placing one of the root's children to the place of the root and move it down to maintain the heap property.

True

False

QUESTION 52

In the implementation of MyQueue, MyQueue contains all the methods defined in MyLinkedList.

True

False

QUESTION 54

The following complexity is O(logn):

45n + 45nlogn + 503

QUESTION 58

A linked structure consists of nodes, where each node is dynamically created to hold an element, and all the nodes are linked together to form a list.

True

False

QUESTION 62

In the implementation of MyLinkedList, if a linked list contains one element, first points to the node and last is null.

True

False

QUESTION 66

In the implementation of MyArrayList, capacity never reduces.

True

False

QUESTION 67

The worst-time complexity for heap sort is ________.

O(1)

O(logn)

O(n)

O(nlogn)

O(n*n)

QUESTION 69

In the implementation of MyLinkedList, MyLinkedList has a capacity property.

True

False

QUESTION 70

A heap can be set up in such a way, where each node is greater than or equal to any of its children.

True

False

QUESTION 71

A binary tree is complete if every level of the tree is full except that the last level may not be full and all the leaves on the last level are placed left-most.

True

False

QUESTION 72

In the implementation of MyArrayList, size never reduces.

True

False

QUESTION 74

In the implementation of MyStack, MyStack contains all the methods defined in MyArrayList.

True

False

True

False

O(nlong)

O(n*n)

QUESTION 75

In the implementation of MyLinkedList, Node has a property named next that links to the node after this node.

True

False

QUESTION 76

In the implementation of MyArrayList, if the current capacity equals to size, capacity is doubled when a new element is added to MyArrayList.

True

False

QUESTION 77

You should always choose a pivot that divides the list evenly.

True

False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!