Question: remove _ at _ index ( self , index: int ) - > None: This method removes the element at the specified index in the

remove_at_index(self, index: int)-> None:
This method removes the element at the specified index in the dynamic array. Index 0
refers to the beginning of the array. If the provided index is invalid, this method must
raise a custom DynamicArrayException. If the array contains N elements, valid
indices for this method are [0, N -1] inclusive.
When the number of elements stored in the array (before removal) is STRICTLY LESS THAN
of its current capacity, the capacity must be reduced to TWICE the number of current
elements. This check and capacity adjustment must occur BEFORE removal of the element.
If the current capacity (before reduction) is 10 elements or less, reduction should not occur
at all. If the current capacity (before reduction) is greater than 10 elements, the reduced
capacity cannot become less than 10 elements. Please see the examples below, especially
example #3, for clarification.
Future assignments will depend on this method being able to run in O(1) best case

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!