1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kozerog [31]
3 years ago
6

Guidelines:

Computers and Technology
1 answer:
OverLord2011 [107]3 years ago
8 0

Answer:

See Explaination

Explanation:

def merge(listA, listB):

if not listA:

return listB

if not listB:

return listA

# create a empty resulting list(merged list)

result = []

# check the first elements of list listA, listB)

if(listA[0]<listB[0]):

# append the first element of listA to result

result.append(listA[0])

# use recursion to get remaning elements

# listA is now reduced to listA[1:]

result.extend(merge(listA[1:],listB))

else:

# append the first element of listB to result

result.append(listB[0])

# use recursion to get remaning elements

# listB is now reduced to listB[1:]

result.extend(merge(listA,listB[1:]))

# return the resultant list

return result

def largest_sum(xs, x, y):

# get number of rows and columns

m = len(xs[0])

n = len(xs)

# if move is invalid

if(x>=n or y>=m):

return 0

# check if we have reached boundary then return xs[x][y]

if(x==(n-1) and y==(m-1)):

return xs[x][y]

else:

# return max of two possible moves(leftmove, down move)

# move left (in this increment x)

left = xs[x][y] + largest_sum(xs,x+1,y)

# move down (in this increment y)

down = xs[x][y] + largest_sum(xs,x,y+1)

# return the maximum of two possible moves

if(left>down):

return left

else:

return down

# test code

print("Output for sample test cases given in problem:")

print(merge([1,2,3], [4,5,6]))

print(largest_sum([[1,2],[3,0]],0,0))

print(largest_sum([[5,6,1],[2,3,3]],0,0))

print(largest_sum([[0,7,5],[6,-1,4],[-5,5,2]],0,0))

print(largest_sum([[0,7,5],[6,-1,4],[-5,5,2]],1,1))

You might be interested in
The government now requires physicians to store patient information in databases that are accessible in multiple locations by mu
musickatia [10]

Answer:

.

Explanation:

3 0
3 years ago
Anyone wanna hop on 1v1.lol<br> party code : usfhb6
hjlf

Answer:

thx for the points

Explanation:

8 0
3 years ago
Read 2 more answers
____ is an easy way to invitation through a web page​
Agata [3.3K]

Answer:

RSVP?

Explanation:

6 0
3 years ago
Read 2 more answers
Which definition of intelligence is based on the Turing test?
Kitty [74]

Answer:

The Turing Test is a deceptively simple method of determining whether a machine can demonstrate human intelligence

Explanation:

8 0
3 years ago
In computer science what major jobs is appropriate for someone who majors in information systems
AURORKA [14]

Answer:

manager

Explanation:

7 0
4 years ago
Other questions:
  • What is cloud storage?​
    11·1 answer
  • Photo editing can transform any image into a great photograph.
    9·1 answer
  • Many of the special staff teams require leadership training, which is offered to staff with more than 1 year of service at Camp
    15·1 answer
  • According to the computer science what isCD ROM is a ​
    8·1 answer
  • a) Write out an abstract class to represent a ball. Include data fields to store the weight of the ball as a double value and th
    6·2 answers
  • Who are the people responsible for maintaining and controlling computer networks within an organization?
    10·1 answer
  • Use a for/else loop to traverse through the key names in the dictionary below in order to find Mr. Potatohead’s mailing address.
    7·1 answer
  • Demonstrate the register addressing mode for the following instructions. Also what addressing mode belongs to these instructions
    11·1 answer
  • hello fellows i need a help.Ineed to know about computer evolutions and computer generations.please hurry.Its my rankover questi
    10·1 answer
  • If the cpu is fast but the bus speed is slow, that condition is called?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!