subject

Question 1: Consider the following two implementations of a function that if given a list, lst, create and return a new list containing the elements of lst in reverse order. def reverse1(lst): rev_lst = [] i = 0 while(i < len(lst)): rev_lst. insert(0, lst[i]) i += 1 return rev_lst def reverse2(lst): rev_lst = [] i = len(lst) - 1 while (i >= 0): rev_lst. append(lst[i]) i -= 1 return rev_lst If lst is a list of n integers, 1. What is the worst case running time of reverse1(lst)? Explain of your answer. 2. What is the worst case running time of reverse2(lst)? Explain of your answer.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:50, williamsgregg5214
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer. b. don’t write your password down and leave it where others can find it. c. share your password with your friends. d.each time you visit a website, retain the cookies on your computer. e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
image
Computers and Technology, 23.06.2019 12:30, umimgoingtofail
What is the difference between the internet and the world wide web?
Answers: 1
image
Computers and Technology, 24.06.2019 02:10, sIatt
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
image
Computers and Technology, 25.06.2019 08:10, Krazyyykiddd
What refrigerant has been approved for new household refrigerators and freezers
Answers: 1
You know the right answer?
Question 1: Consider the following two implementations of a function that if given a list, lst, crea...

Questions in other subjects: