Instructions
We will carry on working with functions! Once more, all input and output has been taken care of for you. All you need to do is finish off the function tableMin that finds the minimum value within a table (2-D list).
Details
Input
Processing
Output
Sample input/output:
| Program input | Program output |
4 6 2 3 4 3 4 2 1 4 8 7 2 8 4 3 7 |
Minimum value: 1 |
There is given code
def tableMin ( ):
"""
FUNCTION: tableMin ( table : list ) -> int
Finds the minimum value within an integer table.
Args:
@param table (list): 2-D integer table (list)
Returns:
@return int: minimum value contained within the table
"""
return
#=========================================================================
# PLEASE END YOUR WORK HERE
#=========================================================================
def main() :
N = int( input() )
table = []
for i in range( N ) :
inputData = input().split()
newRow = []
for j in inputData :
newRow.append( int(j) )
table.append( newRow )
print("Minimum value: ", tableMin( table ))
return
#-----------------#
# Body of program #
#-----------------#
main()
def tableMin(table):
"""
FUNCTION: tableMin ( table : list ) -> int
Finds the minimum value within an integer table.
Args:
@param table (list): 2-D integer table (list)
Returns:
@return int: minimum value contained within the table
"""
if len(table) > 0: # if there is any data in the table
smallest = table[0][0] # set first value of first row as smallest
for lst in table: # go through each row
for num in lst: # go through each value of the row
if num < smallest: # if a smaller number is found
smallest = num # then update smallest variable
return smallest # finally return the smallest value found in the table
# =========================================================================
# PLEASE END YOUR WORK HERE
# =========================================================================
def main():
N = int(input())
table = []
for i in range(N):
inputData = input().split()
newRow = []
for j in inputData:
newRow.append(int(j))
table.append(newRow)
print("Minimum value: ", tableMin(table))
return
# -----------------#
# Body of program #
# -----------------#
main()

Instructions We will carry on working with functions! Once more, all input and output has been...
In C language Write a program that includes a function search() that finds the index of the first element of an input array that contains the value specified. n is the size of the array. If no element of the array contains the value, then the function should return -1. The program takes an int array, the number of elements in the array, and the value that it searches for. The main function takes input, calls the search()function, and displays...
In C language Write a program that includes a function search() that finds the index of the first element of an input array that contains the value specified. n is the size of the array. If no element of the array contains the value, then the function should return -1. The program takes an int array, the number of elements in the array, and the value that it searches for. The main function takes input, calls the search()function, and displays...
use c++ language, keep it simple i am using code block
Exercise #2: Digitise a number Write the function digitiselint, int[]) of type int, which takes an integer N and finds all the digits of that integer and save them in an array. The function then returns the number of digits in N. Write the main() program that reads an integer, calls the function digitisel ), and prints the digits in reverse order. Sample input/output: Enter an integer: 2309456 The...
Need to write a MIPS assembly program that finds the minimum and maximum and sum of a stored array. It also finds the locations of the minimum and maximum. The interaction between the main program and the function is solely through the stack. The function stores $ra immediately after being called and restores $ra before returning to main. The main program reserves a static C like array (index starts from 0) of 10 elements and initializes it. The maximum should...
#include <stdio.h>
// Define other functions here to process the filled array: average, max, min, sort, search
// Define computeAvg here
// Define findMax here
// Define findMin here
// Define selectionSort here ( copy from zyBooks 11.6.1 )
// Define binarySearch here
int main(void) {
// Declare variables
FILE* inFile = NULL; // File pointer
int singleNum; // Data value read from file
int valuesRead; // Number of data values read in by fscanf
int counter=0; // Counter of...
Please help with this question (the two functions). I've attempted it but it's not working. We have to complete the 2 functions int largest(int * x); and void display(int *arr); (one prints the values in array and the other gets max value in array). But we can only use pointer indirection and address arithmetic to access and traverse the array. No array index [] should be used in the functions. C PROGRAMMING: ----------------- /* Passing an array to a function....
Instructions Good news! You have are nearly finished with the semester! Today’s problem is going to be to modify a program to match the actual check used to verify Social Insurance Numbers. Don’t worry, the first part of the solution has been taken care of for you. You just need to modify it to also check the bits in BOLD font. A valid SIN is calculated by multiply odd-positioned digits (1st, 3rd, 5th, 7th, & 9th) by 1 and even-positioned...
In class we wrote a method closestPairFast that on an input array of numbers, finds the distance of the closest pair by first sorting the input array and then finding the closest adjacent pair. (See the file ClosestPair1D.java in the Code folder on D2L.) In this problem, you are asked to modify the method so that it returns an integer array consisting of the indices of the closest pair in the original array. If there is a tie, just return...
please explain [5 pts] What is the outcome of compiling and executing the following code. Assume it is embedded in an otherwise correct and complete C++ program void printBackwards(int *arr, int len){ if (len <=0) return; cout< } int main(){ int arr[4] = {1, 2, 3, 4}; printBackwards(arr, 4); } [10 pts] Implement a function that returns the minimum value in an integer array ‘arr’ of length ‘len’. You MUST use a RECURSIVE solution. //Precondition: An integer array with length...
Write a java program that has a method called sameArrayBackwards. The method takes an array of integers, and checks if the numbers in the array are the same going forward as going backwards and will return a boolean (true or false) depending on the result. You can assume that there is at least one element in the array. Method Header: public static boolean sameArrayBackwards (int [] arr) You will test your method in the main method of your program by...