Problem 4: (7 pts)
To understand the value of recursion in a programming language, write a Program in C++ or Python that implements quicksort, first using recursion and then without recursion. Submit your program source code and screenshot(s) of the output in a separate file (pdf or .docx)
Problem 5: (7 pts)
To understand the value of counting loops, write a program in C++ or Python that implements matrix multiplication using counting loop constructs. Let the user input the size/dimensions of the matrix. Then write the same program using only logical loops—for example, while loops. Submit your program source code and a screenshot of the output in a separate file (pdf or .docx)
--> Quick Sort in Python using recursion

#####################################################################################
# Partition Function
def quickPartition(ar,st,nd):
i = st-1
my_pivot = ar[nd] # initializing pivot
for j in range(st,nd):
if ar[j] < my_pivot:
i = i+1
ar[i],ar[j] = ar[j],ar[i]
ar[i+1],ar[nd] = ar[nd],ar[i+1]
return i+1
# main Sorting Function
def quickSort(ar,st,nd):
if st<nd:
my_pi = quickPartition(ar,st,nd)
quickSort(ar, st, my_pi-1)
quickSort(ar, my_pi+1, nd)
ar=list(map(int,input().split()))
n = len(ar)
print ("Initial array is:")
for i in range(n):
print (ar[i],end=' ')
quickSort(ar,0,n-1)
print ("\nSorted array is:")
for i in range(n):
print (ar[i],end=' ')
#######################################################################
Input & Output:

--------------------------------------------------------------------------------------------------------------------
--> Quick Sort in Python using Itertative


###############################################################################
# Partition Function
def quickPartition(ar,st,nd):
i = st-1
x = ar[nd] # initializing pivot
for j in range(st,nd):
if ar[j] <= x:
i = i+1
ar[i],ar[j] = ar[j],ar[i]
ar[i+1],ar[nd] = ar[nd],ar[i+1]
return i+1
def MyIterativeQuickSort(ar,st,nd):
# using Stack
stack_size = nd-st + 1
mystack = [0] * (stack_size) # declaring stack with 0
stack_top = -1 # initializing top=-1
stack_top = stack_top + 1
mystack[stack_top] = st # adding st to stack
stack_top = stack_top + 1
mystack[stack_top] = nd # adding nd to stack
while stack_top >= 0: # while stack is not empty
nd = mystack[stack_top] # popping nd
stack_top = stack_top - 1
st = mystack[stack_top] # popping st
stack_top = stack_top-1
p = quickPartition(ar,st,nd ) # setting pivot
if p-1 > st: # if pivot is greater than st
stack_top = stack_top + 1
mystack[stack_top] = st
stack_top = stack_top + 1
mystack[stack_top] = p - 1
if p+1 < nd: # if pivot is less than nd
stack_top = stack_top + 1
mystack[stack_top] = p + 1
stack_top = stack_top + 1
mystack[stack_top] = nd
ar=list(map(int,input().split()))
n = len(ar)
print ("Initial array is:")
for i in range(n):
print (ar[i],end=' ')
MyIterativeQuickSort(ar,0,n-1)
print ("\nSorted array is:")
for i in range(n):
print (ar[i],end=' ')
##############################################################################
Input & Output:

----> Matrix Multiplication using counting loop

###############################################################################
n1,m1=map(int,input("Enter The size of first matrix : n
m : ").split())
X=[]
for i in range(n1):
temp=list(map(int,input().split()))
X.append(temp)
n2,m2=map(int,input("Enter The size of second matrix : n
m : ").split())
Y=[]
for i in range(n2):
temp=list(map(int,input().split()))
Y.append(temp)
result=[]
for i in range(m1):
temp=[]
for j in range(n2):
temp.append(0)
result.append(temp)
# iterate through rows of X
for i in range(n1):
# iterate through columns of Y
for j in range(n2):
# iterate through rows of Y
for k in range(m1):
result[i][j] += X[i][k] * Y[k][j]
for r in result:
print(r)
################################################################################
Output & Input:

*** If you have any doubt regarding the solution, Please do ask in the comments ***
Problem 4: (7 pts) To understand the value of recursion in a programming language, write a...
To understand the value of counting loops, write a program in C++ that implements matrix multiplication using counting loop constructs. Let the user input the size/dimensions of the matrix. Then write the same program using only logical loops—for example, while loops.
(20 pts) To understand the value of recursion in a programming language: implement the binary search algorithm first as a recursive function and again using a conditional loop. Your program should create an array of characters holding the letters ‘A’ – ‘Z’ and find the index in the array where the letter ‘K’ is stored. You may use any programming language that supports recursion. (5pts) Define syntax and semantics and give an example. (5pts) Why is it important for a...
Selective Copy. Using Python program, write a program that walks through a folder tree and searches for files with a certain file extension (such as .pdf or .jpg). Copy these files from whatever location they are in to a new folder. Submit the code and a screenshot of the program running in Linux
CSC 211 - Lab-2 Write a C++ program to find the roots of a quadratic equation ax +bx+c=0. The roots are given by the formula, x=-b I56²-4ac 2a x = -b+ √b²-4ac 2. x2 = -b-√6²-4ac 2a Instructions: 1. Type, compile, and run the program in an online C++ compiler. 2. Open a word document and copy the following items onto it: a. The source code b. Screenshot of your program's result 3. Save the word document as lastnameFirstname_Lab2.docx (for...
Write a C program for a program to implement a recursive main. Include a static local variable count initialized to 1. Post increment and print the value of count each time the main is called. The loopcount included in the usage is a positive integer number that will indicate how deep the recursion should go. Usage: lab3 loopcount Code should be nicely indented and commented. Create a simple Makefile to compile your program into an executable called lab3. You should...
Need help with this problem using Python programming as soon as possible, thank you! Write a GUI-based program that implements an image browser for your computer’s file system. The file dialog should filter for GIF image files, and create and open a PhotoImage when a file is accessed.
Problem 3 (20 pts) It is required to write a Matrix Calculator Program using C Programming Language that could only perform addition, subtraction, and multiplication of two matrices of appropriate dimensions. Your program should prompt the user to select a matrix operation from a list of options that contains the aforementioned operations. Then, the user should be prompted to enter the dimensions of the two operand matrices. Next, your program should prompt the user to enter the elements of each...
Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...
4. Comprehensive (20 points) Based on Goodrich Programming Projects 12.1. Write a program to solve the "Vegetarians and Meat Eaters" problem. Three vegetarians and three hungry meat-eaters need to cross a river. Unfortunately, the boat only holds two people. If the meat- eaters outnumber the vegetarians on either bank, the vegetarians will be eaten! Please note: nobody gets to stay on the boat. When there's three meat-eaters on one side, it doesn't matter if one just came over on the...
Recursion Write a program to solve the Towers of Hanoi problem for a tower of size n, using both recursion and iteration. Time each method separately. Be very carefull to time only the actual work and avoid superfluous module calls and initialization, etc. Compare and contrast your two versions of the problem. Are they what you expected? Your analysis must contain a table of the times obtained for each run. For a tower of a particular size, your output should...