gokaymeydan commited on
Commit
30e4290
·
1 Parent(s): 2918f61

add .gitignore

Browse files

add README.md
add algorithms.py
add main.py
add perf_comparison.py
add requirements.txt
add visualizer.py

Files changed (7) hide show
  1. .gitignore +204 -0
  2. README.md +0 -0
  3. algorithms.py +19 -0
  4. main.py +19 -0
  5. perf_comparison.py +0 -0
  6. requirements.txt +47 -0
  7. visualizer.py +0 -0
.gitignore ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ notes.py
2
+ # Byte-compiled / optimized / DLL files
3
+ __pycache__/
4
+ *.py[codz]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ #uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ #poetry.lock
110
+ #poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ #pdm.lock
117
+ #pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ #pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi
127
+
128
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
129
+ __pypackages__/
130
+
131
+ # Celery stuff
132
+ celerybeat-schedule
133
+ celerybeat.pid
134
+
135
+ # SageMath parsed files
136
+ *.sage.py
137
+
138
+ # Environments
139
+ .env
140
+ .envrc
141
+ .venv
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Spyder project settings
149
+ .spyderproject
150
+ .spyproject
151
+
152
+ # Rope project settings
153
+ .ropeproject
154
+
155
+ # mkdocs documentation
156
+ /site
157
+
158
+ # mypy
159
+ .mypy_cache/
160
+ .dmypy.json
161
+ dmypy.json
162
+
163
+ # Pyre type checker
164
+ .pyre/
165
+
166
+ # pytype static type analyzer
167
+ .pytype/
168
+
169
+ # Cython debug symbols
170
+ cython_debug/
171
+
172
+ # PyCharm
173
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
174
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
175
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
176
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
177
+ #.idea/
178
+
179
+ # Abstra
180
+ # Abstra is an AI-powered process automation framework.
181
+ # Ignore directories containing user credentials, local state, and settings.
182
+ # Learn more at https://abstra.io/docs
183
+ .abstra/
184
+
185
+ # Visual Studio Code
186
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
187
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
188
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
189
+ # you could uncomment the following to ignore the entire vscode folder
190
+ # .vscode/
191
+
192
+ # Ruff stuff:
193
+ .ruff_cache/
194
+
195
+ # PyPI configuration file
196
+ .pypirc
197
+
198
+ # Marimo
199
+ marimo/_static/
200
+ marimo/_lsp/
201
+ __marimo__/
202
+
203
+ # Streamlit
204
+ .streamlit/secrets.toml
README.md ADDED
File without changes
algorithms.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # insertion sort
2
+
3
+
4
+ def insertion_sort(arr):
5
+ steps = [] # keep all steps here
6
+
7
+ for j in range(1, len(arr)):
8
+ key = arr[j]
9
+ i = j - 1
10
+
11
+ while i >= 0 and arr[i] > key:
12
+ arr[i + 1] = arr[i]
13
+ i -= 1
14
+ steps.append(arr.copy())
15
+
16
+ arr[i + 1] = key
17
+ steps.append(arr.copy()) # save every moment
18
+
19
+ return steps
main.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from algorithms import insertion_sort
2
+
3
+ my_list = [5, 2, 4, 6, 1, 3]
4
+ steps = insertion_sort(my_list)
5
+ prev = None
6
+
7
+ def print_step(step, prev_step=None):
8
+ for i, num in enumerate(step):
9
+ bar = '█' * num
10
+ if prev_step and prev_step[i] != num:
11
+ print(f"{num:>2} {bar} <- shifted")
12
+ else:
13
+ print(f"{num:>2} {bar}")
14
+ print("-" * 20)
15
+
16
+ for i, step in enumerate(steps):
17
+ print(f"Step {i + 1}: {step}")
18
+ print_step(step,prev)
19
+ prev = step
perf_comparison.py ADDED
File without changes
requirements.txt ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==5.5.0
2
+ attrs==25.3.0
3
+ black==25.1.0
4
+ blinker==1.9.0
5
+ cachetools==6.1.0
6
+ certifi==2025.7.14
7
+ charset-normalizer==3.4.2
8
+ click==8.2.1
9
+ contourpy==1.3.2
10
+ cycler==0.12.1
11
+ fonttools==4.59.0
12
+ gitdb==4.0.12
13
+ GitPython==3.1.44
14
+ idna==3.10
15
+ isort==6.0.1
16
+ Jinja2==3.1.6
17
+ jsonschema==4.25.0
18
+ jsonschema-specifications==2025.4.1
19
+ kiwisolver==1.4.8
20
+ MarkupSafe==3.0.2
21
+ matplotlib==3.10.3
22
+ mypy_extensions==1.1.0
23
+ narwhals==1.48.0
24
+ numpy==2.3.1
25
+ packaging==25.0
26
+ pandas==2.3.1
27
+ pathspec==0.12.1
28
+ pillow==11.3.0
29
+ platformdirs==4.3.8
30
+ protobuf==6.31.1
31
+ pyarrow==21.0.0
32
+ pydeck==0.9.1
33
+ pyparsing==3.2.3
34
+ python-dateutil==2.9.0.post0
35
+ pytz==2025.2
36
+ referencing==0.36.2
37
+ requests==2.32.4
38
+ rpds-py==0.26.0
39
+ six==1.17.0
40
+ smmap==5.0.2
41
+ streamlit==1.47.0
42
+ tenacity==9.1.2
43
+ toml==0.10.2
44
+ tornado==6.5.1
45
+ typing_extensions==4.14.1
46
+ tzdata==2025.2
47
+ urllib3==2.5.0
visualizer.py ADDED
File without changes