Skip to content

Commit

Permalink
New folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
javiermtzo99 committed Jan 15, 2025
1 parent 408a603 commit d7e9040
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 20 deletions.
13 changes: 12 additions & 1 deletion src/datastructpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# read version from installed package
from importlib.metadata import version
__version__ = version("datastructpy")
__version__ = version("datastructpy")

# Import key submodules or classes for easy access
from .node import Node
from .non_linear.trees.binary_search_trees import BinarySearchTree

# Define the public API of the package
__all__ = [
"__version__",
"Node",
"BinarySearchTree",
]
17 changes: 17 additions & 0 deletions src/datastructpy/node.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Node:
"""
A class representing a node in a binary search tree (BST).
Attributes
----------
key : int
The value stored in the node.
left : Node, optional
The left child node (default is None).
right : Node, optional
The right child node (default is None).
"""
def __init__(self, key):
self.key = key
self.left = None
self.right = None
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
class Node:
"""
A class representing a node in a binary search tree (BST).
Attributes
----------
key : int
The value stored in the node.
left : Node, optional
The left child node (default is None).
right : Node, optional
The right child node (default is None).
"""
def __init__(self, key):
self.key = key
self.left = None
self.right = None

class BinarySearchTree:
"""
A class representing a binary search tree (BST).
Expand Down Expand Up @@ -163,4 +145,3 @@ def list_to_tree(elements):
print(bst.root.left.key) # Output: 5 (left child of root)
print(bst.root.right.key) # Output: 15 (right child of root)
"""

2 changes: 2 additions & 0 deletions tests/non-linear/trees/binary_search_tree/test_delete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree

1 change: 1 addition & 0 deletions tests/non-linear/trees/binary_search_tree/test_insert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree
1 change: 1 addition & 0 deletions tests/non-linear/trees/binary_search_tree/test_search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree
2 changes: 2 additions & 0 deletions tests/test_datastructpy.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from datastructpy import datastructpy

# To do: Delete file later

0 comments on commit d7e9040

Please sign in to comment.