Question: # Name: # OSU Email: # Course: CS 2 6 1 - Data Structures # Assignment: # Due Date: # Description: import random from static

# Name:
# OSU Email:
# Course: CS261- Data Structures
# Assignment:
# Due Date:
# Description:
import random
from static_array import *
# ------------------- PROBLEM 1- MIN_MAX -----------------------------------
def min_max(arr: StaticArray)-> tuple[int, int]:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 2- FIZZ_BUZZ ---------------------------------
def fizz_buzz(arr: StaticArray)-> StaticArray:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 3- REVERSE -----------------------------------
def reverse(arr: StaticArray)-> None:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 4- ROTATE ------------------------------------
def rotate(arr: StaticArray, steps: int)-> StaticArray:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 5- SA_RANGE ----------------------------------
def sa_range(start: int, end: int)-> StaticArray:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 6- IS_SORTED ---------------------------------
def is_sorted(arr: StaticArray)-> int:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 7- FIND_MODE -----------------------------------
def find_mode(arr: StaticArray)-> tuple[object, int]:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 8- REMOVE_DUPLICATES -------------------------
def remove_duplicates(arr: StaticArray)-> StaticArray:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 9- COUNT_SORT --------------------------------
def count_sort(arr: StaticArray)-> StaticArray:
"""
TODO: Write this implementation
"""
pass
# ------------------- PROBLEM 10- SORTED SQUARES ---------------------------
def sorted_squares(arr: StaticArray)-> StaticArray:
"""
TODO: Write this implementation
"""
pass
# ------------------- BASIC TESTING -----------------------------------------
if __name__=="__main__":
print('
# min_max example 1')
arr = StaticArray(5)
for i, value in enumerate([7,8,6,-5,4]):
arr[i]= value
print(arr)
result = min_max(arr)
if result:
print(f"Min: {result[0]: 3}, Max: {result[1]}")
else:
print("min_max() not yet implemented")
print('
# min_max example 2')
arr = StaticArray(1)
arr[0]=100
print(arr)
result = min_max(arr)
if result:
print(f"Min: {result[0]}, Max: {result[1]}")
else:
print("min_max() not yet implemented")
print('
# min_max example 3')
test_cases =(
[3,3,3],
[-10,-30,-5,0,-10],
[25,50,0,10],
)
for case in test_cases:
arr = StaticArray(len(case))
for i, value in enumerate(case):
arr[i]= value
print(arr)
result = min_max(arr)
if result:
print(f"Min: {result[0]: 3}, Max: {result[1]}")
else:
print("min_max() not yet implemented")
print('
# fizz_buzz example 1')
source =[_ for _ in range(-5,20,4)]
arr = StaticArray(len(source))
for i, value in enumerate(source):
arr[i]= value
print(fizz_buzz(arr))
print(arr)
print('
# reverse example 1')
source =[_ for _ in range(-20,20,7)]
arr = StaticArray(len(source))
for i, value in enumerate(source):
arr.set(i, value)
print(arr)
reverse(arr)
print(arr)
reverse(arr)
print(arr)
print('
# rotate example 1')
source =[_ for _ in range(-20,20,7)]
arr = StaticArray(len(source))
for i, value in enumerate(source):
arr.set(i, value)
print(arr)
for steps in [1,2,0,-1,-2,28,-100,2**28,-2**31]:
space ="" if steps >=0 else "

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!