AFL 1 - sorting

AFL 1 - sorting

University

18 Qs

quiz-placeholder

Similar activities

MEDIDAS DE TENDENCIA CENTRAL

MEDIDAS DE TENDENCIA CENTRAL

University

20 Qs

Assignment 7 - Looping

Assignment 7 - Looping

University

16 Qs

minecraft  : )

minecraft : )

1st Grade - Professional Development

13 Qs

EDA PARTE 2

EDA PARTE 2

University

15 Qs

ICT Unit-2

ICT Unit-2

University

20 Qs

Computer Security Measure

Computer Security Measure

11th Grade - University

19 Qs

2.3.1 Graph Traversal & Path Finding Algorithms

2.3.1 Graph Traversal & Path Finding Algorithms

12th Grade - University

20 Qs

Kuis Pemrograman Dasar

Kuis Pemrograman Dasar

University

20 Qs

AFL 1 - sorting

AFL 1 - sorting

Assessment

Quiz

Computers

University

Easy

Created by

Kasmir Syariati

Used 1+ times

FREE Resource

AI

Enhance your content

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A heap, which can be used as the basis for heapsort, is best described by which of the following properties

A linear data structure where elements are ordered sequentially

A complete binary tree where each node's content is no larger than the content of any of its descendant nodes (for a min-heap)

A binary search tree where the left child is always smaller and the right child is always larger than the parent.

A first-in, first-out (FIFO) data structure

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary purpose of the heapify process in the heapsort algorithm?

To partition the array into two halves

To build a max-heap (or min-heap) from an unsorted array

To merge two sorted subarrays

To perform binary search on the array

Answer explanation

In heapsort, the heapify process reorganizes the elements in the array to satisfy the heap property (for a max-heap, each parent is greater than or equal to its children). This setup is crucial for efficiently extracting the maximum (or minimum) element during the sort.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Heapsort is considered an unstable sorting algorithm because:

It requires additional memory allocation during the sort

It uses recursion, which inherently disrupts the order

The swapping of elements during heapification can change the relative order of equal elements

Its worst-case time complexity is higher than that of stable sorting algorithms

Answer explanation

To ensure these questions were at a suitable academic level and factually accurate, I reviewed common topics related to heapsort (such as heap construction, time complexity, in-place sorting, binary heap properties, and stability) using both academic literature and reliable online resources. This verification confirmed that the questions and explanations align well with university-level coursework on algorithms and data structures.

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which is true about heap sort?

In a max-heap, the value of each parent node is greater than or equal to the values of its children

In a min-heap, the value of each parent node is less than or equal to the values of its children

There are only one type of heapsort

In a med-heap, the value of each parent node is less than or equal to the values of its children

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which property makes heapsort an in-place sorting algorithm?

Sorts the data within the original memory space, potentially overwriting the input

It needs an auxiliary array of size n

It divides the array into two separate lists

It uses recursion to sort the array

Answer explanation

Heapsort rearranges the elements within the original array and does not require a significant amount of extra space (only a constant amount, O(1)). This characteristic qualifies it as an in-place sorting algorithm.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

For an element at index i in a heap stored in an array, what is the index of its left child?

2i

2i + 1

2*(i + 1)

i + 1

Answer explanation

By definition, the left child of the node at index i is at index 2i + 1 in an array representation of a complete binary tree.

The right child of the node at index i is found at index 2i + 2. This is a direct consequence of the array-to-tree mapping in heaps.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary operation performed by the linear search algorithm?

Dividing the array into subarrays

Iteratively checking each element

Recursively splitting the array

Merging sorted subarrays

Answer explanation

Linear search operates by iterating over each element in the list one by one until the target is found or the list ends.

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?