dsa-study 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pablo Hernandez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.4
2
+ Name: dsa-study
3
+ Version: 0.1.0
4
+ Summary: A project to implement various data structures and algorithms in Python.
5
+ Author: Pablo Hernandez
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.13
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # DSA Study
13
+
14
+ Educational implementations of common data structures and algorithms written in clean, typed, idiomatic Python.
15
+
16
+ > ⚠️ This project is currently under active development and is primarily intended for learning and educational purposes.
17
+
18
+ ## Motivation
19
+
20
+ This project started as part of my journey to build strong software engineering fundamentals.
21
+
22
+ The goal is not only to study data structures and algorithms, but also to apply software engineering practices such as:
23
+
24
+ - API design
25
+ - Type hints
26
+ - Testing
27
+ - Documentation
28
+ - Packaging
29
+ - Versioning
30
+
31
+ This repository serves both as:
32
+
33
+ - A learning project
34
+ - A reference implementation for my personal knowledge base
35
+
36
+ ## Project Goals
37
+
38
+ This library aims to be:
39
+
40
+ 1. Easy to use
41
+ 2. Easy to extend
42
+ 3. Easy to maintain
43
+
44
+ The primary objective is clarity and educational value.
45
+
46
+ Implementations are designed to clearly communicate the underlying ideas behind each data structure and algorithm.
47
+
48
+ Performance and memory optimizations are considered when they help explain the concepts (for example, path compression in Union-Find), but maximum performance is not the primary goal.
49
+
50
+ ## Design Principles
51
+
52
+ ### Data Structures Own Their Data
53
+
54
+ Data structures are responsible for storing and managing their internal state.
55
+
56
+ Examples:
57
+
58
+ - `LinkedList.append()`
59
+ - `BinarySearchTree.insert()`
60
+ - `Graph.add_edge()`
61
+
62
+ ### Algorithms Are Standalone
63
+
64
+ Algorithms operate on data structures but are not part of them.
65
+
66
+ Examples:
67
+
68
+ - `breadth_first_search(graph)`
69
+ - `depth_first_search(graph)`
70
+ - `dijkstra(graph)`
71
+ - `topological_sort(graph)`
72
+
73
+ This separation keeps data structures focused and makes algorithms reusable.
74
+
75
+ ### Explicit and Readable APIs
76
+
77
+ Public APIs favor clarity over brevity.
78
+
79
+ Examples:
80
+
81
+ ```python
82
+ breadth_first_search(graph)
83
+ depth_first_search(graph)
84
+ binary_search(array, target)
85
+ ```
86
+
87
+ instead of abbreviated names.
88
+
89
+ ### Strong Typing
90
+
91
+ All public interfaces use Python type hints.
92
+
93
+ ### Pythonic Error Handling
94
+
95
+ Operations raise exceptions when invalid usage occurs rather than silently returning `None`.
96
+
97
+ ### Educational First
98
+
99
+ The code prioritizes readability and learning value.
100
+
101
+ Implementation choices should make the underlying concepts easy to understand.
102
+
103
+ ## Project Structure
104
+
105
+ ```text
106
+ src/
107
+ └── dsa/
108
+ ├── algorithms/
109
+ ├── data_structures/
110
+ └── graph/
111
+ ```
112
+
113
+ ## Implemented Data Structures
114
+
115
+ ### Linear Structures
116
+
117
+ - [ ] Linked List
118
+ - [ ] Doubly Linked List
119
+ - [ ] Stack
120
+ - [ ] Queue
121
+ - [ ] Priority Queue
122
+
123
+ ### Trees
124
+
125
+ - [ ] Binary Search Tree
126
+ - [ ] Trie
127
+
128
+ ### Graph Structures
129
+
130
+ - [ ] Graph (Adjacency List)
131
+
132
+ ### Disjoint Sets
133
+
134
+ - [ ] Union-Find
135
+
136
+ ## Implemented Algorithms
137
+
138
+ ### Graph Algorithms
139
+
140
+ - [ ] Breadth-First Search (BFS)
141
+ - [ ] Depth-First Search (DFS)
142
+ - [ ] Topological Sort (Kahn)
143
+ - [ ] Topological Sort (DFS)
144
+ - [ ] Dijkstra
145
+ - [ ] Prim
146
+ - [ ] Kruskal
147
+
148
+ ### Sorting Algorithms
149
+
150
+ - [ ] Bubble Sort
151
+ - [ ] Selection Sort
152
+ - [ ] Insertion Sort
153
+ - [ ] Merge Sort
154
+ - [ ] Quick Sort
155
+ - [ ] Heap Sort
156
+
157
+ ### Searching Algorithms
158
+
159
+ - [ ] Binary Search
160
+
161
+ ## Testing Philosophy
162
+
163
+ Every implementation should include tests covering:
164
+
165
+ - Happy path scenarios
166
+ - Edge cases
167
+ - Empty inputs
168
+ - Invalid inputs
169
+
170
+ ## Usage
171
+
172
+ Installation from source:
173
+
174
+ ```bash
175
+ git clone https://github.com/pablohernandezdo/dsa-study-library.git
176
+ cd dsa-study-library
177
+ uv sync
178
+ ```
179
+
180
+ Example:
181
+
182
+ ```python
183
+ from dsa.data_structures import UnionFind
184
+
185
+ uf = UnionFind(["A", "B", "C"])
186
+
187
+ uf.union("A", "B")
188
+
189
+ print(uf.connected("A", "B"))
190
+ ```
191
+
192
+ ## Future Work
193
+
194
+ ### Type System
195
+
196
+ - Learn generic types (`TypeVar`, `Generic`)
197
+ - Make data structures generic
198
+
199
+ ### Graphs
200
+
201
+ - Additional graph representations
202
+ - Weighted graph abstractions
203
+
204
+ ### Algorithms
205
+
206
+ - Dynamic Programming
207
+ - Greedy Algorithms
208
+ - Backtracking
209
+ - String Algorithms
210
+
211
+ ### Tooling
212
+
213
+ - Automated testing with GitHub Actions
214
+ - PyPI publication
215
+ - API documentation generation
216
+
217
+ ## Versioning
218
+
219
+ This project follows Semantic Versioning.
220
+
221
+ Releases are tracked through:
222
+
223
+ - `pyproject.toml`
224
+ - Git tags
225
+ - GitHub releases
@@ -0,0 +1,214 @@
1
+ # DSA Study
2
+
3
+ Educational implementations of common data structures and algorithms written in clean, typed, idiomatic Python.
4
+
5
+ > ⚠️ This project is currently under active development and is primarily intended for learning and educational purposes.
6
+
7
+ ## Motivation
8
+
9
+ This project started as part of my journey to build strong software engineering fundamentals.
10
+
11
+ The goal is not only to study data structures and algorithms, but also to apply software engineering practices such as:
12
+
13
+ - API design
14
+ - Type hints
15
+ - Testing
16
+ - Documentation
17
+ - Packaging
18
+ - Versioning
19
+
20
+ This repository serves both as:
21
+
22
+ - A learning project
23
+ - A reference implementation for my personal knowledge base
24
+
25
+ ## Project Goals
26
+
27
+ This library aims to be:
28
+
29
+ 1. Easy to use
30
+ 2. Easy to extend
31
+ 3. Easy to maintain
32
+
33
+ The primary objective is clarity and educational value.
34
+
35
+ Implementations are designed to clearly communicate the underlying ideas behind each data structure and algorithm.
36
+
37
+ Performance and memory optimizations are considered when they help explain the concepts (for example, path compression in Union-Find), but maximum performance is not the primary goal.
38
+
39
+ ## Design Principles
40
+
41
+ ### Data Structures Own Their Data
42
+
43
+ Data structures are responsible for storing and managing their internal state.
44
+
45
+ Examples:
46
+
47
+ - `LinkedList.append()`
48
+ - `BinarySearchTree.insert()`
49
+ - `Graph.add_edge()`
50
+
51
+ ### Algorithms Are Standalone
52
+
53
+ Algorithms operate on data structures but are not part of them.
54
+
55
+ Examples:
56
+
57
+ - `breadth_first_search(graph)`
58
+ - `depth_first_search(graph)`
59
+ - `dijkstra(graph)`
60
+ - `topological_sort(graph)`
61
+
62
+ This separation keeps data structures focused and makes algorithms reusable.
63
+
64
+ ### Explicit and Readable APIs
65
+
66
+ Public APIs favor clarity over brevity.
67
+
68
+ Examples:
69
+
70
+ ```python
71
+ breadth_first_search(graph)
72
+ depth_first_search(graph)
73
+ binary_search(array, target)
74
+ ```
75
+
76
+ instead of abbreviated names.
77
+
78
+ ### Strong Typing
79
+
80
+ All public interfaces use Python type hints.
81
+
82
+ ### Pythonic Error Handling
83
+
84
+ Operations raise exceptions when invalid usage occurs rather than silently returning `None`.
85
+
86
+ ### Educational First
87
+
88
+ The code prioritizes readability and learning value.
89
+
90
+ Implementation choices should make the underlying concepts easy to understand.
91
+
92
+ ## Project Structure
93
+
94
+ ```text
95
+ src/
96
+ └── dsa/
97
+ ├── algorithms/
98
+ ├── data_structures/
99
+ └── graph/
100
+ ```
101
+
102
+ ## Implemented Data Structures
103
+
104
+ ### Linear Structures
105
+
106
+ - [ ] Linked List
107
+ - [ ] Doubly Linked List
108
+ - [ ] Stack
109
+ - [ ] Queue
110
+ - [ ] Priority Queue
111
+
112
+ ### Trees
113
+
114
+ - [ ] Binary Search Tree
115
+ - [ ] Trie
116
+
117
+ ### Graph Structures
118
+
119
+ - [ ] Graph (Adjacency List)
120
+
121
+ ### Disjoint Sets
122
+
123
+ - [ ] Union-Find
124
+
125
+ ## Implemented Algorithms
126
+
127
+ ### Graph Algorithms
128
+
129
+ - [ ] Breadth-First Search (BFS)
130
+ - [ ] Depth-First Search (DFS)
131
+ - [ ] Topological Sort (Kahn)
132
+ - [ ] Topological Sort (DFS)
133
+ - [ ] Dijkstra
134
+ - [ ] Prim
135
+ - [ ] Kruskal
136
+
137
+ ### Sorting Algorithms
138
+
139
+ - [ ] Bubble Sort
140
+ - [ ] Selection Sort
141
+ - [ ] Insertion Sort
142
+ - [ ] Merge Sort
143
+ - [ ] Quick Sort
144
+ - [ ] Heap Sort
145
+
146
+ ### Searching Algorithms
147
+
148
+ - [ ] Binary Search
149
+
150
+ ## Testing Philosophy
151
+
152
+ Every implementation should include tests covering:
153
+
154
+ - Happy path scenarios
155
+ - Edge cases
156
+ - Empty inputs
157
+ - Invalid inputs
158
+
159
+ ## Usage
160
+
161
+ Installation from source:
162
+
163
+ ```bash
164
+ git clone https://github.com/pablohernandezdo/dsa-study-library.git
165
+ cd dsa-study-library
166
+ uv sync
167
+ ```
168
+
169
+ Example:
170
+
171
+ ```python
172
+ from dsa.data_structures import UnionFind
173
+
174
+ uf = UnionFind(["A", "B", "C"])
175
+
176
+ uf.union("A", "B")
177
+
178
+ print(uf.connected("A", "B"))
179
+ ```
180
+
181
+ ## Future Work
182
+
183
+ ### Type System
184
+
185
+ - Learn generic types (`TypeVar`, `Generic`)
186
+ - Make data structures generic
187
+
188
+ ### Graphs
189
+
190
+ - Additional graph representations
191
+ - Weighted graph abstractions
192
+
193
+ ### Algorithms
194
+
195
+ - Dynamic Programming
196
+ - Greedy Algorithms
197
+ - Backtracking
198
+ - String Algorithms
199
+
200
+ ### Tooling
201
+
202
+ - Automated testing with GitHub Actions
203
+ - PyPI publication
204
+ - API documentation generation
205
+
206
+ ## Versioning
207
+
208
+ This project follows Semantic Versioning.
209
+
210
+ Releases are tracked through:
211
+
212
+ - `pyproject.toml`
213
+ - Git tags
214
+ - GitHub releases
@@ -0,0 +1,18 @@
1
+ [project]
2
+ name = "dsa-study"
3
+ version = "0.1.0"
4
+ description = "A project to implement various data structures and algorithms in Python."
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ license = "MIT"
8
+
9
+ authors = [
10
+ { name = "Pablo Hernandez" }
11
+ ]
12
+ dependencies = []
13
+
14
+ [dependency-groups]
15
+ dev = [
16
+ "pytest>=9.0.3",
17
+ ]
18
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
File without changes
File without changes
@@ -0,0 +1,107 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+
6
+ @dataclass
7
+ class Node:
8
+ value: int
9
+ next: Node | None = None
10
+
11
+
12
+ class LinkedList:
13
+ def __init__(self, head: Node | None = None) -> None:
14
+ self.head = head
15
+
16
+ def __iter__(self):
17
+ pass
18
+
19
+ def __repr__(self) -> str:
20
+
21
+ values: list[int] = []
22
+
23
+ node = self.head
24
+
25
+ while node:
26
+ values.append(node.value)
27
+ node = node.next
28
+
29
+ return f"LinkedList({values})"
30
+
31
+ def __str__(self) -> str:
32
+
33
+ if self.head is None:
34
+ return ""
35
+
36
+ node = self.head
37
+
38
+ representation: str = str(node.value)
39
+ node = node.next
40
+
41
+ while node:
42
+ representation += f" -> {node.value}"
43
+ node = node.next
44
+
45
+ return representation
46
+
47
+ def insert_front(self, value: int) -> None:
48
+
49
+ if self.head is None:
50
+ self.head = Node(value)
51
+ else:
52
+ self.head = Node(value, self.head)
53
+
54
+ def insert_back(self, value: int) -> None:
55
+
56
+ if self.head is None:
57
+ self.head = Node(value)
58
+ else:
59
+ node = self.head
60
+
61
+ while node.next:
62
+ node = node.next
63
+
64
+ node.next = Node(value)
65
+
66
+ def delete(self, value: int) -> None:
67
+ """
68
+ Remove the first occurrence of value from the list.
69
+ """
70
+
71
+ if self.head is None:
72
+ return
73
+
74
+ prev = None
75
+ current = self.head
76
+
77
+ while current:
78
+ if current.value == value:
79
+ if prev is None:
80
+ self.head = current.next
81
+
82
+ else:
83
+ prev.next = current.next
84
+ return
85
+
86
+ prev = current
87
+ current = current.next
88
+
89
+ def find(self, value: int) -> int:
90
+
91
+ if self.head is None:
92
+ return -1
93
+
94
+ idx = 0
95
+ node = self.head
96
+
97
+ while node:
98
+ if node.value == value:
99
+ return idx
100
+
101
+ idx += 1
102
+ node = node.next
103
+
104
+ return -1
105
+
106
+ def clear(self) -> None:
107
+ self.head = None
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.4
2
+ Name: dsa-study
3
+ Version: 0.1.0
4
+ Summary: A project to implement various data structures and algorithms in Python.
5
+ Author: Pablo Hernandez
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.13
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # DSA Study
13
+
14
+ Educational implementations of common data structures and algorithms written in clean, typed, idiomatic Python.
15
+
16
+ > ⚠️ This project is currently under active development and is primarily intended for learning and educational purposes.
17
+
18
+ ## Motivation
19
+
20
+ This project started as part of my journey to build strong software engineering fundamentals.
21
+
22
+ The goal is not only to study data structures and algorithms, but also to apply software engineering practices such as:
23
+
24
+ - API design
25
+ - Type hints
26
+ - Testing
27
+ - Documentation
28
+ - Packaging
29
+ - Versioning
30
+
31
+ This repository serves both as:
32
+
33
+ - A learning project
34
+ - A reference implementation for my personal knowledge base
35
+
36
+ ## Project Goals
37
+
38
+ This library aims to be:
39
+
40
+ 1. Easy to use
41
+ 2. Easy to extend
42
+ 3. Easy to maintain
43
+
44
+ The primary objective is clarity and educational value.
45
+
46
+ Implementations are designed to clearly communicate the underlying ideas behind each data structure and algorithm.
47
+
48
+ Performance and memory optimizations are considered when they help explain the concepts (for example, path compression in Union-Find), but maximum performance is not the primary goal.
49
+
50
+ ## Design Principles
51
+
52
+ ### Data Structures Own Their Data
53
+
54
+ Data structures are responsible for storing and managing their internal state.
55
+
56
+ Examples:
57
+
58
+ - `LinkedList.append()`
59
+ - `BinarySearchTree.insert()`
60
+ - `Graph.add_edge()`
61
+
62
+ ### Algorithms Are Standalone
63
+
64
+ Algorithms operate on data structures but are not part of them.
65
+
66
+ Examples:
67
+
68
+ - `breadth_first_search(graph)`
69
+ - `depth_first_search(graph)`
70
+ - `dijkstra(graph)`
71
+ - `topological_sort(graph)`
72
+
73
+ This separation keeps data structures focused and makes algorithms reusable.
74
+
75
+ ### Explicit and Readable APIs
76
+
77
+ Public APIs favor clarity over brevity.
78
+
79
+ Examples:
80
+
81
+ ```python
82
+ breadth_first_search(graph)
83
+ depth_first_search(graph)
84
+ binary_search(array, target)
85
+ ```
86
+
87
+ instead of abbreviated names.
88
+
89
+ ### Strong Typing
90
+
91
+ All public interfaces use Python type hints.
92
+
93
+ ### Pythonic Error Handling
94
+
95
+ Operations raise exceptions when invalid usage occurs rather than silently returning `None`.
96
+
97
+ ### Educational First
98
+
99
+ The code prioritizes readability and learning value.
100
+
101
+ Implementation choices should make the underlying concepts easy to understand.
102
+
103
+ ## Project Structure
104
+
105
+ ```text
106
+ src/
107
+ └── dsa/
108
+ ├── algorithms/
109
+ ├── data_structures/
110
+ └── graph/
111
+ ```
112
+
113
+ ## Implemented Data Structures
114
+
115
+ ### Linear Structures
116
+
117
+ - [ ] Linked List
118
+ - [ ] Doubly Linked List
119
+ - [ ] Stack
120
+ - [ ] Queue
121
+ - [ ] Priority Queue
122
+
123
+ ### Trees
124
+
125
+ - [ ] Binary Search Tree
126
+ - [ ] Trie
127
+
128
+ ### Graph Structures
129
+
130
+ - [ ] Graph (Adjacency List)
131
+
132
+ ### Disjoint Sets
133
+
134
+ - [ ] Union-Find
135
+
136
+ ## Implemented Algorithms
137
+
138
+ ### Graph Algorithms
139
+
140
+ - [ ] Breadth-First Search (BFS)
141
+ - [ ] Depth-First Search (DFS)
142
+ - [ ] Topological Sort (Kahn)
143
+ - [ ] Topological Sort (DFS)
144
+ - [ ] Dijkstra
145
+ - [ ] Prim
146
+ - [ ] Kruskal
147
+
148
+ ### Sorting Algorithms
149
+
150
+ - [ ] Bubble Sort
151
+ - [ ] Selection Sort
152
+ - [ ] Insertion Sort
153
+ - [ ] Merge Sort
154
+ - [ ] Quick Sort
155
+ - [ ] Heap Sort
156
+
157
+ ### Searching Algorithms
158
+
159
+ - [ ] Binary Search
160
+
161
+ ## Testing Philosophy
162
+
163
+ Every implementation should include tests covering:
164
+
165
+ - Happy path scenarios
166
+ - Edge cases
167
+ - Empty inputs
168
+ - Invalid inputs
169
+
170
+ ## Usage
171
+
172
+ Installation from source:
173
+
174
+ ```bash
175
+ git clone https://github.com/pablohernandezdo/dsa-study-library.git
176
+ cd dsa-study-library
177
+ uv sync
178
+ ```
179
+
180
+ Example:
181
+
182
+ ```python
183
+ from dsa.data_structures import UnionFind
184
+
185
+ uf = UnionFind(["A", "B", "C"])
186
+
187
+ uf.union("A", "B")
188
+
189
+ print(uf.connected("A", "B"))
190
+ ```
191
+
192
+ ## Future Work
193
+
194
+ ### Type System
195
+
196
+ - Learn generic types (`TypeVar`, `Generic`)
197
+ - Make data structures generic
198
+
199
+ ### Graphs
200
+
201
+ - Additional graph representations
202
+ - Weighted graph abstractions
203
+
204
+ ### Algorithms
205
+
206
+ - Dynamic Programming
207
+ - Greedy Algorithms
208
+ - Backtracking
209
+ - String Algorithms
210
+
211
+ ### Tooling
212
+
213
+ - Automated testing with GitHub Actions
214
+ - PyPI publication
215
+ - API documentation generation
216
+
217
+ ## Versioning
218
+
219
+ This project follows Semantic Versioning.
220
+
221
+ Releases are tracked through:
222
+
223
+ - `pyproject.toml`
224
+ - Git tags
225
+ - GitHub releases
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/dsa/__init__.py
5
+ src/dsa/algorithms/__init__.py
6
+ src/dsa/data_structures/__init__.py
7
+ src/dsa/data_structures/linked_list.py
8
+ src/dsa_study.egg-info/PKG-INFO
9
+ src/dsa_study.egg-info/SOURCES.txt
10
+ src/dsa_study.egg-info/dependency_links.txt
11
+ src/dsa_study.egg-info/top_level.txt