Question: would like this done in python anything that is in green is what i need to do anything in red are hints on how to

 would like this done in python anything that is in green

is what i need to do anything in red are hints on

would like this done in python

anything that is in green is what i need to do

anything in red are hints on how to solve the problem

copy of code:

class ArrayList:

def __init__(self, size=1000):

self.max_size = size # maximum memory capacity

self.data = Array(self.max_size) # create initial array

self.curr_size = 0 # current actual size

# TODO: Feel free to add more lines here

# TODO: Implement this method - Required Time Complexity: O(1)

def __getitem__(self, idx):

"""Implements 'value = self[idx]'

Raises IndexError if idx is invalid."""

raise NotImplementedError()

# TODO: Implement this method - Required Time Complexity: O(1)

def __setitem__(self, idx, value):

"""Implements 'self[idx] = value'

Raises IndexError if idx is invalid."""

raise NotImplementedError()

def __len__(self):

"""Implements 'len(self)'"""

return self.curr_size

# TODO: Implement this method - Required Time Complexity: O(1), except

# when you need to create a larger array to fit more elements

def append(self, value):

"""Appends value to the end of this list."""

raise NotImplementedError()

# TODO: Implement this method - Required Time Complexity: O(1), except

# when you need to create a larger array to fit more elements

def preprend(self, value):

"""Prepends value to the start of this list."""

raise NotImplementedError()

# TODO: Implement this method - Required Time Complexity: O(n), except

# when idx == 0 or idx == len(self). In these cases, call append/prepend

def insert(self, idx, value):

"""Inserts value at position idx, shifting the original elements down

the list, as needed. Note that inserting a value at len(self) ---

equivalent to appending the value --- is permitted.

Raises IndexError if idx is invalid."""

raise NotImplementedError()

# TODO: Implement this method - Required Time Complexity: O(n), except

# when 'value' is the first element in the list. In that case,

# the expected time complexity is O(1)

def remove(self, value):

"""Removes the first (closest to the front) instance of value from the

list. Raises a ValueError if value is not found in the list."""

raise NotImplementedError()

# TODO: Implement this method - Required Time Complexity: O(n), except

# when idx == 0 or idx == len(self) - 1. In those cases,

# the expected time complexity is O(1)

def delete(self, idx):

"""Removes the element at index 'idx' from the

list. Raises a IndexError if index is invalid"""

raise NotImplementedError()

# TODO: Implement this method - Required Time Complexity: O(n)

def __contains__(self, value):

"""Implements `val in self`. Returns true iff value is in the list."""

raise NotImplementedError()

class ArrayList: def __init_(self, size=1000): self.max_size = size # maximum memory capacity self.data = Array(self.max_size) # create initial array self.curr_size = 0# current actual size # TODO: Feel free to add more lines here # TODO: Implement this method - Required Time Complexity: 0(1) def __getitem_(self, idx): "Implements 'value = self[idx]' Raises IndexError if idx is invalid." raise Not ImplementedError() # TODO: Implement this method - Required Time Complexity: 0(1) def _setitem_(self, idx, value): "Implements 'self[idx] = value Raises IndexError if idx is invalid.". raise NotImplementedError() def __len_(self): """Implements 'len(self)"""|| return self.curr_size # TODO: Implement this method - Required Time Complexity: 0(1), except # when you need to create a larger array to fit more elements def append(self, value): ""Appends value to the end of this list.". raise NotImplementedError() # TODO: Implement this method - Required Time Complexity: 0(1), except # when you need to create a larger array to fit more elements def preprend(self, value): "Prepends value to the start of this list." raise Not ImplementedError() # TODO: Implement this method - Required Time Complexity: 0(n), except # when idx == 0 or idx == len(self). In these cases, call append/prepend def insert (self, idx, value): """Inserts value at position idx, shifting the original elements down the list, as needed. Note that inserting a value at len(self) equivalent to appending the value --- is permitted. Raises IndexError if idx is invalid.". raise Not ImplementedError() # TODO: Implement this method - Required Time Complexity: 0(n), except # when 'value' is the first element in the list. In that case, # the expected time complexity is 0(1) def remove(self, value): "Removes the first (closest to the front) instance of value from the list. Raises a ValueError if value is not found in the list." raise Not ImplementedError() # TODO: Implement this method - Required Time Complexity: 0(n), except # when idx == 0 or idx == len(self) - 1. In those cases, # the expected time complexity is 0(1) def delete (self, idx): "Removes the element at index 'id' from the list. Raises a IndexError if index is invalid". raise Not ImplementedError() # TODO: Implement this method - Required Time Complexity: 0(n) def _contains_(self, value): "Implements 'val in self". Returns true iff value is in the list." raise Not ImplementedError()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!