Problem 1: Two Sum
Problem Description: Given an array of integers (not necessarily sorted), return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
For example, if you are given an array [2, 7, 11, 9] with a target 9, then you will return [0, 1] since the first two numbers add up to 9. It is important that you solve this problem using divide and conquer and recursion. That is, you must divide the original problem into subproblems, recursively solve the subproblems, and then combine the solutions to the subproblems to obtain the solution to the original problem.
Your solution should take O(n log n) time. If you don’t use divide and conquer and recursion then you will not get any points for this assignment. The following has to be given.
Submission should contain a code file, and a pdf (report)
(a) Give the pseudocode for your solution. Also explain in English why your solution works. (30 points)
(b) Show correctness of your algorithm and analyze its complexity. (20 points).
(c) Code up your solution in C++ Your code should be well commented. Your code should compile, otherwise no points. (50 points)
Hints: • Figure out how to efficiently check for the solution if the input is sorted.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of