Question: Lab 3 report - Sort and search algorithms and comparison 1 . Objective: The student will practice how to - Implement and give analysis for

Lab 3 report - Sort and search algorithms and comparison
1. Objective:
The student will practice how to
- Implement and give analysis for one of the sorting algorithms (task 1)
- Apply the proper sorting and searching algorithms to solve a given problem. (tasks 2 and 3)
- Give an analysis for the proposed solution.
2. Tasks:
2.1. Running time of algorithms:
Given an array A, sort it using insertion sort.
Required:
- Write a function to calculate number of shifts required to sort the array.
- What is the running time of insertion sort?
2.2. Missing numbers:
Given two arrays of integers, find which elements in the second array are missing from the first array.
Required:
- Write a function to find the missing numbers from the second array.
- What is the time and space complexity for your code?
2.3. Minimum absolute difference for an array:
The absolute difference is the positive difference between two values \( a \) and \( b \), is written \(|\mathrm{a}-\mathrm{b}|\) or \(|\mathrm{b}-\mathrm{a}|\). Given an array of integers, find the minimum absolute difference between any two elements in the array.
Required:
- Write a function to find the minimum absolute difference.
- What is the time and space complexity for your code?
Lab 3 report - Sort and search algorithms and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!