Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the questions below please: 1) Which sorting algorithm divides the array around a pivot, then sorts the left and right sides? Selection Sort Insertion

Answer the questions below please:

1) Which sorting algorithm divides the array around a pivot, then sorts the left and right sides?

Selection Sort

Insertion Sort

Bubble Sort

Merge Sort

Quicksort

2) Why is the average space complexity of an in-place, recursive quicksort O(log n) instead of O(1)?

The algorithm creates two variables for every element in the array.

Each recursive step stays in memory until the entire algorithm completes.

The algorithm creates a new array each step that is the same size as the original.

Recursion adds space equal to the recursion depth, but the array size halves each time it recurses.

 0 / \ 1 2 / \ \ 3 4 5 / / \ / \ 6 7 8 9 10

3) Assuming each edge points downward, select from this list of the data structure that the diagram above could model.

Singly Linked List

Binary Tree

Doubly Linked List

Binary Search Tree

4) Will using a breadth-first search algorithm guarantee to return the shortest distance between two nodes in an unweighted graph?

False

True

5) Which sorting algorithm swaps out-of-order adjacent pairs until the array is sorted?

Merge Sort

Bubble Sort

Quick Sort

Selection Sort

Insertion Sort

6) Which of the following lines of code will sort an array of integers from greatest to least?

arr.sort((a, b) => b - a)

arr.sort((a, b) => a > b)

arr.sort((a, b) => a < b)

arr.sort((a, b) => a - b)

arr.sort()

7) Which sorting algorithm incrementally moves the smallest values from an unsorted array to a sorted array?

Selection Sort

Merge Sort

Insertion Sort

Quick Sort

Bubble Sort

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions