Created
February 4, 2019 11:42
-
-
Save gunnarig/c2529559cb6f91414fb15d99758ff092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def insert(self, value, index): | |
if self.__capacity == self.__size: | |
self.__size * self.__capacity | |
return ArrayList.insert(self,value,index) | |
elif self.__capacity >= self.__size: | |
count = 1 | |
while index >= count: | |
if count != index: | |
self.__arr[self.__size+1-count] = self.__arr[self.__size-count] | |
count += 1 | |
elif count == index: | |
self.__arr[index-1] = value | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment