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
To locate all the documents in a Mongo database that match an expression, use the _____________ method.
Lena [83]

Answer:

find()

Explanation:

When dealing with MongoDB the method that needs to be used in this scenario would be the find() method. This method basically returns all of the records that exist in the collection on which it is called, if no parameter is passed. If you pass a parameter/expression then only the records that match completely the expression will be returned to the user, otherwise nothing is returned. For example, on a database (db) we would call the following

db.find() ... This will return all records

db.find({specific}) ... This will return only the records that match specific.

4 0
3 years ago
given:an int variable k,an int array currentMembers that has been declared and initialized,an int variable memberID that has bee
Oksi-84 [34.3K]

Answer:

// The code segment is written in C++ programming language

// The code segment goes as follows

for (k = 0; k < nMembers; k++)

{

//check if memberID can be found in currentMembers

if (currentMembers[k] == memberID){

// If yes,

// assigns true to isAMember

isAMember = true;

k = nMembers;

}

else{

isAMember = false;

// If no

// assigns false to isAMember

}

}

// End of segment:

The following assumption were made in the code segment above.

There exists

1. An already declared and initialised int array currentMembers.

2. An already initialised int variable memberID

Line 3 initiates a loop to scan through the array

Line 6 checks for the condition below

If current element of array equals memberID then

It assigns true to isAMember and nMembers to k

Else

It assigns false to isAMember

7 0
3 years ago
Why might your coworker suggest encrypting an archive file before e-mailing it??
Genrish500 [490]
Because to prevent MITD (Man in the middle is a man that in the middle of the network. For example: You are sending a text, the man in the middle or in the modem will receive the text and can edit it and send it to the receiver, or the man will put the virus in...) and to prevent server snooping
8 0
3 years ago
What is meant by usability and what characteristics of an interface are used to assess a system’s usability?
ahrayia [7]

Answer:

The answer is below

Explanation:

Usability is a term that describes the assessment of the performance of a system in assisting the task of the user, or how effective a certain product system or design supports the task of a user in accomplishing a set out objective as desired.

The characteristics of an interface that are used to assess a system’s usability are:

1. Effectiveness

2. Efficiency

3. Error Tolerance

4. Engagement

5. Ease of Learning and Navigation

3 0
3 years ago
Which of the following is NOT one of the MOST common uses of Twitter?
I am Lyosha [343]
Which of the following is NOT one of the MOST common uses of Twitter? b . Making a business contact.
5 0
3 years ago
Other questions:
  • Dani wants to create a web page to document her travel adventures. Which coding language should she use? HTML Java Python Text
    15·1 answer
  • A simple algorithm for handling requests works like this:________ a) all requests users make are stored. b) The elevator priorit
    15·2 answers
  • Is cheque money? give reason​
    9·1 answer
  • Under what category of programs and apps do screen savers and backup programs fall?
    10·1 answer
  • As a culture chnages so does its language<br><br> A.true <br> B.false
    5·1 answer
  • 1. What does a network allow computers to share?
    13·1 answer
  • A rugby team has 15 players. A bus company has big buses that can carry 48 passengers and small buses that can carry 10 passenge
    10·1 answer
  • Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the
    13·1 answer
  • What is typescript can you please give me a description of what it is
    13·1 answer
  • Write a print statement that displays a random integer between 5 and 5000. Assume the random library is imported.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!