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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place?
Answers: 1
question
Computers and Technology, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
Lakendra finished working on her monthly report. in looking it over, she saw that it had large blocks of white space. what steps could lakendra take to reduce the amount of white space?
Answers: 3
question
Computers and Technology, 24.06.2019 02:10
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
You know the right answer?
Question 1: Consider the following two implementations of a function that if given a list, lst, crea...
Questions
question
Mathematics, 24.08.2019 20:30
question
Mathematics, 24.08.2019 20:30
question
Chemistry, 24.08.2019 20:30
Questions on the website: 13722362