Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help for Data Structure Hw: 1. Which of the list operations shown below is not O(1)? -list.pop(0) - list.pop() -list.append() -list(10) 2. Which of

Need help for Data Structure Hw:

1. Which of the list operations shown below is not O(1)?

-list.pop(0)

- list.pop()

-list.append()

-list(10)

2. Which of the dictionary operations shown below is O(n)?

- 'x' in mydict
- del mydict['x']
- mydict['x'] == 10
- mydict['x'] = mydict['x'] + 1
-

mydict2 = mydict.copy()

3. Give the Big-O performance of the following code fragment:

if 'alice' in x: # x is a list print('yes')

- O(n)
- O(1)
- O(n^2)
-

On^3)

4.Give the Big-O performance of the following code fragment: x is a list

x.insert(2,'bye')

-O(n)
-O(n log n)
-O(n!)

-O(n^3)

5. Give the Big-O performance of the following code fragment:

x = [1,2,3,4,5,6,7,8,9,10,11]

y = [4,5,6,7,5]

x[:3] = y[:3]

- O(n^3)
- O(n+k)
- O(n^2)
- O(log n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions