Final answer:
To print a table of runtimes for given functions on arrays, you can write a program that measures the runtime of each function using a timer and stores the results in a table.
Step-by-step explanation:
To write a program that prints a table of runtimes for given functions on arrays, you can use a loop to iterate over the functions and arrays. Measure the runtime of each function using a timer, and store the results in a table. Here's an example in Python:
import time
def function1(array):
# Function implementation
pass
def function2(array):
# Function implementation
pass
functions = [function1, function2]
arrays = [...]
table = []
for function in functions:
row = []
for array in arrays:
start_time = time.time()
function(array)
end_time = time.time()
runtime = end_time - start_time
row.append(runtime)
table.append(row)
# Print the table
for array in arrays:
print(f'\t{array}', end='')
print()
for i, function in enumerate(functions):
print(f'{function.__name__}\t', end='')
for j, runtime in enumerate(table[i]):
print(f'{runtime}\t', end='')
print()