0% found this document useful (0 votes)
5 views

Assignment 3

The document outlines a class assignment focused on searching and sorting algorithms. It includes questions on the differences between linear and binary search, Python implementations for binary search and sorting algorithms, and an analysis of time complexities for bubble sort and quick sort. Additionally, it requires a program to merge two sorted arrays without built-in functions.

Uploaded by

nyame3434
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment 3

The document outlines a class assignment focused on searching and sorting algorithms. It includes questions on the differences between linear and binary search, Python implementations for binary search and sorting algorithms, and an analysis of time complexities for bubble sort and quick sort. Additionally, it requires a program to merge two sorted arrays without built-in functions.

Uploaded by

nyame3434
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Class Assignment 2: Searching and Sorting Algorithms

Questions:

1. Explain the difference between linear search and binary search.


Which one is more efficient, and why?

2. Write Python code to implement the binary search algorithm for a


sorted list. Test your implementation on the list: [2, 4, 6, 8, 10,
12] to find the index of 8.

3. Given the following list: [5, 3, 8, 6, 2], sort the list using:
a. Bubble sort
b. Selection sort

4. Analyze the worst-case and best-case time complexity of:


a. Bubble sort
b. Quick sort

5. Write a Python program to merge two sorted arrays into a single


sorted array without using built-in functions.

You might also like