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]

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]],1,1) β†’ 6

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:20
Usually, when we sniff packets, we are only interested certain types of packets. we can do that by setting filters in sniffing. scapy’s filter use the bpf (berkeley packet filter) syntax; you can find the bpf manual from the internet. set the following filters and demonstrate your sniffer program again (each filter should be set separately): (a) capture only the icmp packet. (b) capture any tcp packet that comes from a particular ip and with a destination port number 23. (c) capture packets comes from or to go to a particular subnet. you can pick any subnet, such as 128.230.0.0/16; you should not pick the subnet that your vm is attached to.
Answers: 3
question
Computers and Technology, 24.06.2019 01:00
How can the temperature of a room be raised by 5degreesf?
Answers: 1
question
Computers and Technology, 24.06.2019 12:30
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion is this and example of
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
Ramp charts are generally created in wordlotusexcelpowerpoint
Answers: 1
You know the right answer?
Guidelines:
ο‚· Loops are completely banned (for loop and while loop)
ο‚· You must use rec...
Questions
question
English, 29.06.2020 05:01
Questions on the website: 13722361