diff --git a/pydatastructs/linear_data_structures/arrays.py b/pydatastructs/linear_data_structures/arrays.py index bf96ee5..cc92c93 100644 --- a/pydatastructs/linear_data_structures/arrays.py +++ b/pydatastructs/linear_data_structures/arrays.py @@ -63,9 +63,9 @@ class OneDimensionalArray(Array): .. [1] https://en.wikipedia.org/wiki/Array_data_structure#One-dimensional_arrays ''' - - __slots__ = ['_size', '_data'] - + + __slots__ = ['_size', '_data', '_dtype'] + def __new__(cls, dtype=NoneType, *args, **kwargs): if dtype == NoneType or len(args) not in (1, 2): raise ValueError("1D array cannot be created due to incorrect" diff --git a/pydatastructs/miscellaneous_data_structures/stack.py b/pydatastructs/miscellaneous_data_structures/stack.py index e7f75a8..9b82ca4 100644 --- a/pydatastructs/miscellaneous_data_structures/stack.py +++ b/pydatastructs/miscellaneous_data_structures/stack.py @@ -84,8 +84,8 @@ class Stack(object): class ArrayStack(Stack): - __slots__ = ['maxsize', 'top', 'items'] - + __slots__ = ['maxsize', 'top', 'items', 'dtype'] + def __new__(cls, maxsize=None, top=0, items=None, dtype=int): if not _check_type(maxsize, int): raise ValueError("maxsize is missing.") diff --git a/pydatastructs/trees/binary_trees.py b/pydatastructs/trees/binary_trees.py index a1d2aec..e8fb820 100644 --- a/pydatastructs/trees/binary_trees.py +++ b/pydatastructs/trees/binary_trees.py @@ -182,9 +182,7 @@ class BinarySearchTree(BinaryTree): pydatastructs.trees.binary_tree.BinaryTree """ - - __slots__ = ['root_idx', 'comparator', 'tree', 'size'] - + def insert(self, key, data): walk = self.root_idx if self.tree[walk].key == None: @@ -305,9 +303,6 @@ class AVLTree(BinarySearchTree): balance_factor = lambda self, node: self.right_height(node) - \ self.left_height(node) - - __slots__ = ['root_idx', 'comparator', 'tree', 'size'] - def _right_rotate(self, j, k): y = self.tree[k].right if y != None: