main
Alexandre B A Villares 2020-10-06 23:31:51 -03:00
rodzic 88cc1e89f2
commit 90c21afe1d
3 zmienionych plików z 41 dodań i 0 usunięć

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 410 KiB

Wyświetl plik

@ -0,0 +1,35 @@
nums = [random(512) for _ in range(512)]
i = 0
def setup():
size(512, 512)
colorMode(HSB)
def draw():
background(200)
global i
for x, n in enumerate(nums):
stroke(n / 2, 255, 255)
line(x, n, x, height)
tam = len(nums)
if i < width - 1:
m = i
for j in range(i + 1, tam):
if nums[j] < nums[m]:
m = j
if nums[i] != nums[m]:
nums[i], nums[m] = nums[m], nums[i]
i += 1
def selection_sort(nums):
# int i, j, m, aux;
tam = len(nums)
for i in range(tam - 1):
m = i
for j in range(i + 1, tam):
if nums[j] < nums[m]:
m = j
if nums[i] != nums[m]:
nums[i], nums[m] = nums[m], nums[i]

Wyświetl plik

@ -26,6 +26,12 @@ Some of the tools I have used:
---
![sketch_2020_10_06sel_sort](2020/sketch_2020_10_06sel_sort/sketch_2020_10_06sel_sort.gif)
[sketch_2020_10_06sel_sort](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_10_06sel_sort) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
---
![sketch_2020_10_05d](2020/sketch_2020_10_05d/sketch_2020_10_05d.gif)
[sketch_2020_10_05d](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_10_05d) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]