Filters
Question type

Study Flashcards

Every algorithm for a problem has the same efficiency.

Correct Answer

verifed

verified

If there are more items in a search pool, then it will typically require more comparisons to find an item.

Correct Answer

verifed

verified

Write out the state of the list while being sorted using the selection sort algorithm: Write out the state of the list while being sorted using the selection sort algorithm:

Correct Answer

verifed

verified

1 6 3 55 110 8 93 703
1 3 6 55...

View Answer

Which of the following algorithms has a worst case complexity of O(n log2n) ?


A) insertion sort
B) selection sort
C) bubble sort
D) merge sort
E) none of the above

Correct Answer

verifed

verified

Explain how quick sort works.

Correct Answer

verifed

verified

Quick sort works by first selecting a pi...

View Answer

Explain how merge sort works.

Correct Answer

verifed

verified

Merge sort works by dividing the list in...

View Answer

A linear search always requires more comparisons than a binary search.

Correct Answer

verifed

verified

In a binary search, _______________________________ .


A) it is assumed that all of the elements are integers.
B) it is assumed that all of the elements are Strings.
C) it is assumed that the search pool is small.
D) it is assumed that the search pool is ordered.
E) it is assumed that the search pool is large.

Correct Answer

verifed

verified

Quick sort works by separating a list into two lists, and recursively sorting the two lists using quick sort.

Correct Answer

verifed

verified

The __________________ algorithm sorts a list of values by repetitively inserting a particular value into a subset of the list that has already been sorted.


A) insertion sort
B) selection sort
C) bubble sort
D) quick sort
E) merge sort

Correct Answer

verifed

verified

Write a method that accepts an integer array as a parameter and sorts it using the bubble sort algorithm.

Correct Answer

verifed

verified

public void bubbleSort(int[] array) {
in...

View Answer

Write a method that accepts an array of integers as a parameter and sorts them using the selection sort algorithm.

Correct Answer

verifed

verified

public void selectionSort(int [] array) ...

View Answer

To represent constant time complexity we use O(c).

Correct Answer

verifed

verified

What is the complexity of the following code (in terms of the length of the array)? for(int i = 0; i < 5; i++) System.out.println(array[i]);

Correct Answer

verifed

verified

The complexity of th...

View Answer

The ___________________ of an algorithm shows the relationship between the size of the problem and the value we hope to optimize.


A) growth function
B) growth analysis
C) size function
D) size analysis
E) none of the above

Correct Answer

verifed

verified

Bubble sort works by separating a list into two lists, recursively sorting the two lists using bubble sort, and then combining the sorted sublists into a sorted list.

Correct Answer

verifed

verified

Which of the following algorithms has a worst-case complexity of O(n2) ?


A) insertion sort
B) selection sort
C) bubble sort
D) all of the above
E) neither a, b, nor c

Correct Answer

verifed

verified

With each comparison, a binary search eliminates approximately half of the items remaining in the search pool.

Correct Answer

verifed

verified

The selection sort algorithm sorts a list of values by repeatedly putting a particular value into its final, sorted position.

Correct Answer

verifed

verified

Which of the following algorithms is most easily expressed recursively?


A) linear search
B) quick sort
C) bubble sort
D) selection sort
E) none of the above algorithms are easily expressible recursively

Correct Answer

verifed

verified

Showing 21 - 40 of 40

Related Exams

Show Answer