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
Jlenok [28]
3 years ago
5

Write a recursive function that prints out the items of a (possibly empty) singly linked list of integers in reverse order. The

function should run in linear time.
Computers and Technology
1 answer:
MrRa [10]3 years ago
8 0

Answer:

Follows are the method definition to this question:

void Reverse_Order(struct Node* h)//defining a recursive method Reverse_Order that takes structure in parameter

{

if (h == NULL)//use if block to check head equal to null

return;//use return keyword

Reverse_Order(h->next);//call method recursively

cout<<h->data;//print data

}

Explanation:

In the above code, a recursive method "Reverse_Order" takes structure as the parameter, and inside the method, structure variable h is used that uses the if conditional statement to check the header equal to null.

In the condition is true, it will use the return keyword, and in the next step, it calls the method recursively, and print its value in the reverse order.

You might be interested in
By generating and delivering timely and relevant information supported by networks, _____ creates new opportunities for conducti
castortr0y [4]

Answer:

The correct option to the following question is option (B). e-business.

Explanation:

E-business is stands for the Electronic business.

E-business is the business which is conduct by the uses of the internet, Web, extranet or intranet, etc.

E-business is also known as the online business where online transactions take place.

E-business facilitates our customers that the selling and the buying of the goods between the consumers and the merchants.

7 0
4 years ago
You are given a list of n positive integers a1, a2, . . . an and a positive integer t. Use dynamic programming to design an algo
Anna11 [10]

Answer:

See explaination for the program code

Explanation:

The code below

Pseudo-code:

//each item ai is used at most once

isSubsetSum(A[],n,t)//takes array of items of size n, and sum t

{

boolean subset[n+1][t+1];//creating a boolean mtraix

for i=1 to n+1

subset[i][1] = true; //initially setting all first column values as true

for i = 2 to t+1

subset[1][i] = false; //initialy setting all first row values as false

for i=2 to n

{

for j=2 to t

{

if(j<A[i-1])

subset[i][j] = subset[i-1][j];

if (j >= A[i-1])

subset[i][j] = subset[i-1][j] ||

subset[i - 1][j-set[i-1]];

}

}

//returns true if there is a subset with given sum t

//other wise returns false

return subset[n][t];

}

Recurrence relation:

T(n) =T(n-1)+ t//here t is runtime of inner loop, and innner loop will run n times

T(1)=1

solving recurrence:

T(n)=T(n-1)+t

T(n)=T(n-2)+t+t

T(n)=T(n-2)+2t

T(n)=T(n-3)+3t

,,

,

T(n)=T(n-n-1)+(n-1)t

T(n)=T(1)+(n-1)t

T(n)=1+(n-1)t = O(nt)

//so complexity is :O(nt)//where n is number of element, t is given sum

6 0
3 years ago
Access 1.04 knowing your audience
luda_lava [24]

Answer:

What?

Explanation:

I would like to help, but what is the question

4 0
4 years ago
time to throw poggers xqc time to throw pogchamp time to throw pogchamp time to throw pogchamp time to throw pogchamp time to th
Effectus [21]
Yes thank you very much
6 0
3 years ago
Read 2 more answers
It's not possible to die in an alcohol-related collision if you're not in an automobile.
frutty [35]

Answer:

B. False

Explanation:

  • Consumption of alcohol is not a good practice and is generally not allowed at the time of driving an automobile and is considered to be an offense as it may be injurious to health and property.
  • As too much alcohol can create possible chances of collusions and even if the person is not in an automobile can result in a collision if tries to cross the road. Like head injuries or leg injuries can occur.
8 0
3 years ago
Other questions:
  • Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number re
    14·1 answer
  • In what year did commercial use of the Internet become available? 1991 1996 1999 2001
    9·1 answer
  • The ret instruction (without operands) will pop how many bytes off the stack?
    7·1 answer
  • Using illustration how input, process and output in latest wearable devices
    10·1 answer
  • What is the information age?
    12·1 answer
  • Once you record your audio and click ok to save it what happens to the recording?
    9·1 answer
  • . Write a C++ Code to get a multiline statement Str1 from a user with a ‘$’ as return character (Hint:
    6·1 answer
  • Can’t be opened because apple cannot check it for malicious software.
    15·1 answer
  • HELP PLEASE!!!!!!!!!<br> Please fix the coding! thanks I give brainliest
    5·1 answer
  • Structured query language (sql) enables data analysts to _____ the information in a database.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!