Skip to content

Commit 724ea4d

Browse files
committed
Alterado o arquivo readme
1 parent 87521aa commit 724ea4d

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

Diff for: README.md

+9-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
<h1>sorting_algorithms_python</h1>
2-
<br>
3-
Sort algorithms implemented in Python.
4-
<br><br><br>
5-
Bubble<br>
6-
Insertion<br>
7-
Selection<br>
8-
Quick<br>
9-
Merge<br>
10-
Shell<br>
11-
Heap<br>
12-
Counting<br>
13-
Radix<br>
14-
Bucket<br>
15-
Gnome<br>
16-
Comb<br>
17-
Cocktail<br>
1+
# Sorting Algorithms in Python
2+
3+
4+
This is just a demonstration of the implementation of some sorting algorithms using Python. There are implementations of
5+
sorting in Python's standard library that are much better for performance reasons.
6+
When I wrote these codes I was learning Python and I wanted to do some exercises to improve my Python skills and then
7+
since I was taking Data Structures classes in college I implemented the algorithms in Python, I already knew the most
8+
well-known sort algorithms, but I ended up getting myself excited and learning a few more as was the case with Comb,
9+
Gnome Cocktail and Shell Sort.

Diff for: src/sort/sort.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ def bubble(nlist):
1414
if size <= 1:
1515
return nlist
1616

17-
exchanges = True
17+
swapped = True
1818

1919
for i in range(size):
20-
if not exchanges: break
21-
exchanges = False
20+
if not swapped:
21+
break
22+
23+
swapped = False
24+
2225
for j in range(size - i):
2326
if nlist[j] > nlist[j + 1]:
24-
nlist[j + 1], nlist[j] = nlist[j], nlist[j + 1]
25-
exchanges = True
27+
nlist[j + 1], nlist[j] = nlist[j], nlist[j + 1]
28+
swapped = True
2629

2730
return nlist
2831

0 commit comments

Comments
 (0)