Question: A. Implement the following functions of recursion in Python. 1. A function Write() that takes an argument n and prints the numbers in reverse order

A. Implement the following functions of recursion in Python.

A. Implement the following functions of recursion in Python. 1. A function

Write() that takes an argument n and prints the numbers in reverse

order recursively. def Write(n): // your code goes here Example: Write (5)

#The result should be like this: 5 4 3 2 1 2.

1. A function Write() that takes an argument n and prints the numbers in reverse order recursively. def Write(n): // your code goes here Example: Write (5) #The result should be like this: 5 4 3 2 1 2. Add a function Factorial() that returns the factorial of a number. def Factorial (n): // your code goes here Example: Factorial(5) #The result should be like this: 5! = 5x4x3x2x1 = 120 3. A function GCDC) that takes two numbers and returns their greatest common divisor. def GCD (a,b): // your code goes here Example: GCD (8,12) #The function should return 4 Algorithm: GCD (a,0) = a GCD (a,b) = GCD (b, a mod b) Recursive case Base Case 4. A function BinarySearch() that implements the binary search algorithm for non-empty sorted array using recursion. The function should take the arguments List, value, low, high and returns the location of the searched value. def BinarySearch (List, low, high, value): // your code goes here 5. A function QuickSort() which sorts the list in ascending/descending order. def QuickSort(): // your code goes here function partition Func(left, right, pivot) leftPointer = left rightPointer right 1 while True do while A[++left Pointer] 0 && A[--rightPointer] > pivot do //do-nothing end while if left Pointer >= right Pointer break else swap left Pointer, right Pointer end if end while swap left Pointer, right return left Pointer end function procedure quickSort (left, right) if right-left

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!