100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS1521 Assignment 3 (COMPLETE ANSWERS) 2024 (532267) - DUE 22 July 2024 $2.50   Add to cart

Exam (elaborations)

COS1521 Assignment 3 (COMPLETE ANSWERS) 2024 (532267) - DUE 22 July 2024

 79 views  2 purchases
  • Course
  • Institution
  • Book

COS1521 Assignment 3 (COMPLETE ANSWERS) 2024 (532267) - DUE 22 July 2024

Preview 3 out of 24  pages

  • July 20, 2024
  • 24
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
BEST COS1521
COS1521
Assignment 3
(COMPLETE
ANSWERS) 2024
(532267) - DUE 22
July 2024 ; 100%
TRUSTED Complete,
trusted solutions and
explanations

,COS1521 Assignment 3 (COMPLETE ANSWERS) 2024 (532267)
- DUE 22 July 2024 ; 100% TRUSTED Complete, trusted
solutions and explanations.
Question 1 Complete Marked out of 1.00

Suppose a list contains the following elements: 27, 37, 7. What is the order of
the elements in the list after three passes when selection sort is used?

In selection sort, we repeatedly find the minimum element from the unsorted part
and move it to the beginning. Here’s the step-by-step process:

1. First pass: Find the smallest element in the list (7) and swap it with the first
element (27).
o List after first pass: 7, 37, 27
2. Second pass: Find the smallest element in the remaining unsorted part (27
and 37). The smallest is 27, so we swap it with the second element (37).
o List after second pass: 7, 27, 37
3. Third pass: The remaining part has only one element (37), which is already
in its correct position.
o List after third pass: 7, 27, 37


So, the order of the elements after three passes is: 7, 27, 37

Answer: None of the provided options are correct.




Question 2 Complete Marked out of 1.00 QUIZ Suppose a list contains the
following elements: 27 37 7 What is the order of the elements in the list
after three passes when selection sort is used? a. 27 37 71 b. 73 77 37 c.
73 37 71 d. 73 47 71 Which of the following statements regarding sorting
algorithms is TRUE? a. Insertion sort is the most effi cient sorting algorithm.
b. Selection sort is more effi cient than bucket sort. c. Heap sort is less suffi
cient than bubblesort. d. Merge sort is more effi cient that selection sort.

Which of the following statements regarding sorting algorithms is TRUE?

, a. Insertion sort is the most efficient sorting algorithm.
b. Selection sort is more efficient than bucket sort.
c. Heap sort is less efficient than bubble sort.
d. Merge sort is more efficient than selection sort.

Explanation:

 a. This statement is false. Insertion sort is not the most efficient sorting
algorithm, especially for large datasets.
 b. This statement is false. Bucket sort is generally more efficient than
selection sort for large datasets with a uniform distribution.
 c. This statement is false. Heap sort is generally more efficient than bubble
sort.
 d. This statement is true. Merge sort has a time complexity of O(n log n),
which is generally more efficient than selection sort’s O(n^2) for large
datasets.

Answer: d. Merge sort is more efficient than selection sort.




Question 3 Complete Marked out of 1.00

Which one of the following statements is NOT true regarding selection sort?

a. The list to be sorted is divided into two sublists – sorted and unsorted.
b. A sort pass is defined as moving an element from the unsorted sublist to the sorted sublist.
c. If we have a list of 20 elements to be sorted, it will take 19 passes to get the list sorted.
d. Selection sort is faster than merge sort and bucket sort.

Explanation:

 a. True. Selection sort divides the list into a sorted sublist and an unsorted sublist.
 b. True. Each pass in selection sort involves moving an element from the unsorted sublist
to the sorted sublist.
 c. True. It takes n−1n-1n−1 passes to sort a list of nnn elements.
 d. False. Selection sort is not faster than merge sort and bucket sort for large datasets.
Merge sort has a time complexity of O(nlog⁡n)O(n \log n)O(nlogn), which is better than
the O(n2)O(n^2)O(n2) time complexity of selection sort.

Answer: d. Selection sort is faster than merge sort and bucket sort.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller THEBLAZE1. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $2.50. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67096 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$2.50  2x  sold
  • (0)
  Add to cart