Skip to content

Commit

Permalink
Removed unnecessary aliasing of OneDimensionalArray (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShebinJoseph committed Mar 17, 2020
1 parent 4845b22 commit eea0cdc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pydatastructs/linear_data_structures/arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class OneDimensionalArray(Array):
Examples
========
>>> from pydatastructs import OneDimensionalArray as ODA
>>> arr = ODA(int, 5)
>>> from pydatastructs import OneDimensionalArray
>>> arr = OneDimensionalArray(int, 5)
>>> arr.fill(6)
>>> arr[0]
6
Expand Down Expand Up @@ -127,7 +127,6 @@ def fill(self, elem):
for i in range(self._size):
self._data[i] = elem

ODA = OneDimensionalArray

class DynamicArray(Array):
"""
Expand Down Expand Up @@ -216,7 +215,7 @@ def _modify(self):
below load factor.
"""
if self._num/self._size < self._load_factor:
arr_new = ODA(self._dtype, 2*self._num + 1)
arr_new = OneDimensionalArray(self._dtype, 2*self._num + 1)
j = 0
for i in range(self._last_pos_filled + 1):
if self[i] is not None:
Expand All @@ -228,7 +227,7 @@ def _modify(self):

def append(self, el):
if self._last_pos_filled + 1 == self._size:
arr_new = ODA(self._dtype, 2*self._size + 1)
arr_new = OneDimensionalArray(self._dtype, 2*self._size + 1)
for i in range(self._last_pos_filled + 1):
arr_new[i] = self[i]
arr_new[self._last_pos_filled + 1] = el
Expand Down

0 comments on commit eea0cdc

Please sign in to comment.