Question: In python language please Problem 1 (Multiplying Recursively) Write a recursive function called multiply(int,int) which calculates the value of ab without using multiplication (only use

 In python language please Problem 1 (Multiplying Recursively) Write a recursiveIn python language please

Problem 1 (Multiplying Recursively) Write a recursive function called multiply(int,int) which calculates the value of ab without using multiplication (only use addition/subtraction operators for calculations). To do this, think of how multiplication is really computed in the most basic sense and identify the base/recursive cases. Test out the function with various numbers. Problem 2 (Insertion Sort) We covered two O(n2) sorting algorithms in class - selection sort and bubble sort The pseudocode below is for another sorting algorithm called insertion sort. Implement an insertion sort function and test it with several lists InsertionSort(list) For i from 1 to length of list-1 (inclusive) Setj to i While j>0 and list-1]> list j Swap listi-1] and listil Setj to j-1 What is the best and worst case runtime complexity of insertion sort? Problem 3 (Reversing Strings Recursively) Write a recursive function that takes a string and returns the reverse of that string. For example, reverse( string")gnirts and reverse(hello there)ereht olleh. You can use the slicing operators to extract sections/characters from the string and work toward a base case. Problem 4 (Merging Lists Recursively) Write a recursive function that takes 2 sorted lists as arguments and returns a single, merged sorted list as a result. For example, if the two input lists are [0, 2, 4, 6, 8] and [1 3, 5,7, 9], the returned result should be [0, 1, 2, 3,4, 5, 6, 7, 8, 9). Remember that you can add lists in Python using the + operator a0] + [1.2.31-p. 1.2.3]) and can take slices of lists with the slice operator (if x-[0. 1. 2. 3. 4], x[1:]-[1, 2, 3, 4). You could also use the other list methods that are available if you think they are applicable (e.g. pop). Remember to think about the base case(s) and how you will move toward a smaller problem at each step

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 Databases Questions!