def main(): a = Array(3) a[0] = Array(3) a[1] = Array(6) a[2] = Array(8) for i in range(3): for j in range(len(a[i])): print(a[i][j], end=" ") print("")
def main(): depth = 4 row = 4 col = 4 arr = Array(depth) for i in range(depth): arr[i] = Array(row) for i in range(depth): for j in range(row): arr[i][j] = Array(col) for i in range(depth): for j in range(row): for k in range(col): arr[i][j][k] = i * 100 + j * 10 + k print(arr[2][3][3])
def __init__(self, source_collection=None): """Sets the initial state of self, which includes the contents of source collection, if it's present.""" self._items = Array(ArrayBag.DEFAULT_CAPACITY) self._size = 0 if source_collection: for item in source_collection: self.add(item)
def main(): array = Array(10) for i in range(array.capacity): array[i] = i + 1 head = None for i in range(array.logical_size - 1, -1, -1): head = Node(array[i], head) while head != None: print(head._data) head = head._next
def __init__(self, rows, columns, fill_value=None): self._data = Array(rows) for row in range(rows): self._data[row] = Array(columns, fill_value)
def clear(self): """Make self become empty.""" self._size = 0 self._items = Array(ArrayBag.DEFAULT_CAPACITY)
def __init__(self, row, col, fill_value=None): self._data = Array(row) for i in range(row): self._data[i] = Array(col, fill_value)