Skip to content

Commit 33f3220

Browse files
committed
update Readme
1 parent 77853ac commit 33f3220

File tree

3 files changed

+20
-86
lines changed

3 files changed

+20
-86
lines changed

README.md

+20-86
Original file line numberDiff line numberDiff line change
@@ -129,107 +129,41 @@
129129
130130
├── README.md
131131
├── requirements.txt
132-
├── test_runer.py
133-
└── test_runer.sh
132+
├── test_runner.py
133+
└── test_runner.sh
134134

135135

136136
```
137137

138-
# pre requirements
139-
``` bash
140-
pip install -r requirements.txt
141-
```
142-
143138
# Sorting Algorithms
144-
- [Bubble sort](#bubble-sort)
145-
- [Insertion sort](#insertion-sort)
146-
- [Selection sort](#selection-sort)
147-
- [Quick sort](#quick-sort)
148-
- first
149-
- last
150-
- medianOfThree
151-
- Random
152-
- [Merge sort](#merge-sort)
153-
- [Counting sort](#counting-sort)
154-
155-
156-
## Bubble Sort
157-
158-
Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.
159-
160-
### Invariants
161-
- Initialization: The list is unsorted.
162-
- Maintenance: After each iteration, the largest unsorted element is placed at its correct position.
163-
- Termination: The list is sorted.
164-
165-
### Complexity
166-
167-
Time Complexity:
168-
- Best Case: `O(n)` - When the array is already sorted.
169-
- Worst Case: `O(n^2)` When the array is sorted in reverse order.
170-
- Average Case: `O(n^2)`
171-
172-
Space Complexity:
173-
- `O(1)` - The algorithm sorts the input array in-place.
174-
## Insertion Sort
175-
Insertion sort is a simple sorting algorithm that builds the final sorted list one item at a time. It iterates through the input list, removing one element at a time and then finding its correct position within the sorted part of the list. It repeats this process until no unsorted elements remain.
176-
177-
### Invariants
178-
- Initialization: The list is unsorted.
179-
- Maintenance: After each iteration, the current element is inserted into its correct position within the sorted part of the list.
180-
- Termination: The list is sorted.
181-
182-
### Complexity
183-
Time Complexity:
184-
- Best Case: `O(n)` - When the array is already sorted.
185-
- Worst Case: `O(n^2)` - When the array is sorted in reverse order.
186-
- Average Case: `O(n^2)`
187-
188-
Space Complexity:
189-
- `O(1)` - The algorithm sorts the input array in-place.
190-
191-
192-
## Selection Sort
193-
Selection sort is a simple sorting algorithm that divides the input list into two parts: the sorted sublist and the unsorted sublist. Initially, the sorted sublist is empty, and the unsorted sublist contains all the elements. The algorithm repeatedly finds the smallest (or largest, depending on the sorting order) element from the unsorted sublist and moves it to the end of the sorted sublist. This process continues until the unsorted sublist becomes empty.
194139

195-
### Invariants
196-
- Initialization: The entire list is unsorted.
197-
- Maintenance: After each iteration, the smallest (or largest) element from the unsorted sublist is moved to its correct position in the sorted sublist.
198-
- Termination: The entire list is sorted.
199-
200-
### Complexity
201-
Time Complexity:
202-
- Best Case: O(n^2)
203-
- Worst Case: O(n^2)
204-
- Average Case: O(n^2)
205-
Space Complexity:
206-
- O(1) - The algorithm sorts the input array in-place.
207-
208-
## Quick Sort
209-
210-
## Merge Sort
211-
212-
## Counting Sort
140+
## pre requirements for Sorting Algorithms test auto run
213141

142+
To recreate the environment, you can run:
214143

144+
``` bash
145+
python -m venv .venv
146+
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
147+
pip install -r requirements.txt
148+
```
215149

150+
Or if using `pipenv`:
216151

217-
## for testing
218152
```bash
219-
g++ <path_to_test_file > <path_to_according_src_file> -o <result_name> -lgtest -lgtest_main -pthread
153+
pipenv install -r requirements.txt
220154
```
221155

222-
## test_bubble_sort
223-
```bash
224-
g++ tests/test_bubble_sort.cpp src/1__bubble_sort.cpp -o bubble_sort_test -lgtest -lgtest_main
225-
```
226156

227-
## test_insertion_sort
157+
after you can run `test_runner.py` by
158+
228159
```bash
229-
g++ tests/test_insertion_sort.cpp src/2__insertion_sort.cpp -o insertion_sort_test -lgtest -lgtest_main
160+
./test_runner.py
161+
#or
162+
python test_runner.py
230163
```
231164

232-
## test_merge_sort
165+
## for manual testing
166+
233167
```bash
234-
g++ tests/test_merge_sort.cpp src/5__merge_sort.cpp -o merge_sort_test -lgtest -lgtest_main-lgtest_main
235-
```
168+
g++ <path_to_test_file > <path_to_according_src_file> -o <result_name> -lgtest -lgtest_main -pthread
169+
```
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)