subject

Guidelines:
ο‚· Loops are completely banned (for loop and while loop)
ο‚· You must use recursion in each function
ο‚· You are not allowed to import anything.
ο‚· You are not allowed to use the built-in function max(). Everything else is okay
ο‚· You are allowed to use sets, dictionaries, and any of their respective operations.
ο‚· You are allowed to use any string method except for string. join()
ο‚· You can do string slicing, but you cannot use the string[::-1] shortcut.
ο‚· You can use any list operation, except for list. sort() and list. reverse()
ο‚· Do not hard code to the examples

Functions (You must use recursion in each function WITHOUT altering the original function signature):
def merge(listA, listB):
Description: Combine two lists into one list, maintaining the order of the elements. You should assume that both lists given to this function contain elements in ascending order (smallest first).
Parameters: listA, listB, two lists of elements (could be anything – assume homogenous data)
Return value: a list, the combination of elements from listA and listB in ascending order.
Examples:
merge([1,2,3], [4,5,6]) β†’ [1,2,3,4,5,6]
merge([1,2,3], [2,3,4]) β†’ [1,2,2,3,3,4]
merge([2,4,6], [1,3,5]) β†’ [1,2,3,4,5,6]

Functions (You must use recursion in each function WITHOUT altering the original function signature):
def largest_sum(xs, x, y):
Description: Zig-zag through a two-dimensional list of integers from some starting point until you reach one of the list's boundaries, computing the largest sum that you find along the way. X and Y represent the row and column position in xs of the first number to use in the sum. The zig-zag pattern is made by limiting yourself to only looking at the number immediately on the right of (x, y) and the number immediately below (x, y) when figuring out which of those numbers yields the largest sum.
Parameters: xs, a 2D list of integers, x, y are the row and col position in xs
Return value: an integer, the largest sum you can find from position (x, y)
Examples:
largest_sum([[1,2],[3,0]],0,0) β†’ 4
largest_sum([[5,6,1],[2,3,3]],0,0) β†’ 17
largest_sum([[0,7,5],[6,-1,4],[-5,5 ,2]],0,0) β†’ 18
largest_sum([[0,7,5],[6,-1,4],[-5,5 ,2

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
This technology is used to produce high-quality documents that look good on the computer screen and in print. wiki presentation paint desktop publishing
Answers: 3
question
Computers and Technology, 22.06.2019 13:00
Write a program which asks you to enter a name in the form of first middle initial last. so you might enter for example samuel p. clemens. use getline to read in the string because it contains spaces. also, apparently the shift key on your keyboard doesn’t work, because you enter it all lower case. pass the string to a function which uses .find to locate the letters which need to be upper case and use toupper to convert those characters to uppercase. the revised string should then be returned to main in the form last, first mi where it will be displayed.
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which of the following would you find on a network
Answers: 3
question
Computers and Technology, 23.06.2019 01:40
Writing a modular program in visual c++. i am new to this and not sure what i am missing. i am getting the following error: baddate.cpp: in function β€˜int main()’: baddate.cpp: 50: 3: error: β€˜else’ without a previous β€˜if’elsehere are the instructions and code: writing a modular program in c++in this lab, you add the input and output statements to a partially completed c++ program. when completed, the user should be able to enter a year, a month, and a day. the program then determines if the date is valid. valid years are those that are greater than 0, valid months include the values 1 through 12, and valid days include the values 1 through 31.notice that variables have been declared for you.write the simulated housekeeping() function that contains the prompts and input statements to retrieve a year, a month, and a day from the user.include the output statements in the simulated endofjob() function. the format of the output is as follows: month/day/year is a valid date.ormonth/day/year is an invalid date.execute the program entering the following date: month = 5, day = 32, year = 2014. record the output of this program.execute the program entering the following date: month = 9, day = 21, year = 2002. record the output of this /* program name: baddate.cppfunction: this program determines if a date entered by the user is valid.input: interactiveoutput: valid date is printed or user is alerted that an invalid date was entered*/#include bool validatedate(int, int, int); using namespace std; int main(){// declare variablesint year; int month; int day; const int min_year = 0, min_month = 1, max_month = 12, min_day = 1, max_day = 31; bool validdate = true; // this is the work of the housekeeping() method// get the year, then the month, then the daycout< < "enter the year"< > year; cout< < "enter the month"< > month; cout< < "enter the day"< > day; // this is the work of the detailloop() method// check to be sure date is validif(year < = min_year) // invalid yearvaliddate = false; else if (month < min_month || month > max_month) // invalid monthvaliddate = false; else if (day < min_day || day > max_day) // invalid dayvaliddate = false; // this is the work of the endofjob() method// test to see if date is valid and output date and whether it is valid or notif(validdate == true); {// output statementcout<
Answers: 1
You know the right answer?
Guidelines:
ο‚· Loops are completely banned (for loop and while loop)
ο‚· You must use recur...
Questions
question
Mathematics, 25.07.2019 03:30
question
History, 25.07.2019 03:30
question
Mathematics, 25.07.2019 03:30
Questions on the website: 13722361