end Flashcards

1
Q

Which sorting algorithm uses the divide-and-conquer approach?

A

c.
Quick Sort

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In a graph with multiple connected components, how many times will BFS be called?

A

d.
The number of connected components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

when an algorithm generates the same address for different identifiers it is known as

A

a.
Collisions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What data structure is used in DFS to keep track of the visited nodes?

A

d.
Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The capacity and load factor are parameters that affect the Hash Table performance

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following techniques can be used to search an element in an unsorted array?

A

b.
Iterative linear search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the worst case runtime of linear search algorithm?

A

b.
O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Each class provides its own implementation of hashCode()

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following sorting algorithm has best case time complexity of O(n^2)?

A

b.
selection sort

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the minimum number of edges required for a connected undirected graph with n vertices?

A

c.
n-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In a weighted graph, which of the following algorithms can be used to find the shortest path from a source node to all other nodes?

A

d.
Dijkstra’s algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following sorting algorithms not has a worst-case time complexity of O(n^2)?

A

a.
Merge Sort

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Object class contains hashCode() method with its default implementation

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Selected pivot point can be only first element in quick sort.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following methods can be used to search an element in a linked list?

A

d.
Iterative linear search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The following method is an implementation of ___________.

public static void XXX(int[] arr, int left, int right) {

if (left >= right) {

return;

}

int pivot = YYY(arr, left, right);

XXX(arr, left, pivot - 1);

XXX(arr, pivot + 1, right);

}

public static int YYY(int[] arr, int left, int right) {

int pivot = arr[right];

int i = left - 1;

for (int j = left; j < right; j++) {

if (arr[j] < pivot) {

  i++;

  int temp = arr[i];

  arr[i] = arr[j];

  arr[j] = temp;

}

}

int temp = arr[i + 1];

arr[i + 1] = arr[right];

arr[right] = temp;

return i + 1;

}

A

a.
Quick sort

17
Q

Binary Search can be categorized into which of the following?

A

c.
Divide and conquer

18
Q

Which of the following sorting algorithms has a best-case time complexity of O(n)?

A

a.
Merge Sort

19
Q

Which of the following sorting algorithms requires extra memory space to sort an array?

A

c.
Merge Sort

20
Q

Which of the following sorting algorithms has a time complexity of O(n*log(n)) in the average case?

A

d.
Merge Sort

21
Q

Binary search algorithm is also called Bisection search method.

A

True

22
Q

What is a heap in computer science?

A

d.
A data structure for efficiently finding the minimum or maximum element.