What's your username on them?
Answer:
Following are the program in the Python Programming Language.
#define function
def Transfer(S, T):
#set for loop
for i in range(len(S)):
#append in the list
T.append(S.pop())
#return the value of the list
return T
#set list type variable
S = ["a","b","c","d"]
#print the values of the list
print(S)
#set the list empty type variable
T=[]
#call the function
T = Transfer(S, T)
#print the value of T
print(T)
<u>Output:</u>
['a', 'b', 'c', 'd']
['d', 'c', 'b', 'a']
Explanation:
Here, we define the function "Transfer()" in which we pass two list type arguments "S" and "T".
- Set the for loop to append the values in the list.
- Then, we append the value of the variable "S" in the variable "T".
- Return the value of the list variable "T" and close the function.
- Then, set the list data type variable "S" and initialize the elements in it and print that variable.
- Finally, we set the empty list type variable "T" and store the return value of the function "Transfer()" in the variable "T" then, print the value of the variable "T".
Answer:
Given that:
A= 40n^2
B = 2n^3
By given scenario:
40n^2=2n^3
dividing both sides by 2
20n^2=n^3
dividing both sides by n^2 we get
20 = n
Now putting n=20 in algorithms A and B:
A=40n^2
= 40 (20)^2
= 40 * (400)
A= 16000
B= 2n^3
= 2 (20)^3
= 2(8000)
B= 16000
Now as A and B got same on n = 20, then as given:
n0 <20 for n =20
Let us take n0 = 19, it will prove A is better than B.
We can also match the respective graphs of algorithms of A and B to see which one leads and which one lags, before they cross at n= 20.