Answered step by step
Verified Expert Solution
Question
1 Approved Answer
solve the problems using c++ please In this assignment, we will apply the idea of divide and conquer algorithms (similar to binary search) to solve
solve the problems using c++ please
In this assignment, we will apply the idea of divide and conquer algorithms (similar to binary search) to solve the below questions. Note: The running time of your solutions should be Ollogn). Question 1. Implementing the square root function: Write a function that asks a user to enter an integer N and returns [VN Example 1: input: 28 Output: 6 Example 2: input: 16 Output: 4 (Note: You are NOT allowed to use the built-in sqrt function in your code Do NOT use any type of array in your code) Question 2. Given a sorted array of n distinct numbers where the range of the numbers are between 0 tom and m> n(m is given by user). Find the smallest missing number. Example 1: input: a = [0, 1, 3, 6, 8, 9), m = 10 Output: 2 Example 2: input: a = [2, 5, 7, 11), m = 15 Output: 0 Example 3. input: a = [0, 1, 2, 3, 4), m = 8 Output: 5 Example 4: input: a = [12], m = 13 Output: 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started