This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import ceil | |
def _return_list_gaps(size, ratio=None): | |
gaps = list() | |
if not ratio: | |
ratio = 2.2 | |
while size > 1: | |
size = ceil(size / ratio) | |
gaps.append(size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def selection_sort_optimized(array, decrescent=False): | |
if len(array) <= 1: | |
return array | |
for x in range(len(array)): | |
left_swap_index = x | |
right_swap_index = x | |
for y in range(x + 1, len(array) - x): | |
if ((decrescent and array[y] > array[left_swap_index]) or | |
(not decrescent and array[y] < array[left_swap_index])): | |
left_swap_index = y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def selection_sort(array, decrescent=False): | |
if len(array) <= 1: | |
return array | |
for x in range(len(array)): | |
swap_index = x | |
for y in range(x + 1, len(array)): | |
if ((decrescent and array[y] > array[swap_index]) or | |
(not decrescent and array[y] < array[swap_index])): | |
swap_index = y | |
array[x], array[swap_index] = array[swap_index], array[x] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def insertion_sort_optimized(array, decrescent=False): | |
if len(array) <= 1: | |
return array | |
for x in range(1, len(array)): | |
current = array[x] | |
y = x - 1 | |
while y >= 0 and ((decrescent and current > array[y]) or | |
(not decrescent and current < array[y])): | |
array[y + 1] = array[y] | |
y = y - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def insertion_sort(array, decrescent=False): | |
if len(array) <= 1: | |
return array | |
for x in range(1, len(array)): | |
y = x | |
while y > 0 and ((decrescent and array[y] > array[y - 1]) or | |
(not decrescent and array[y] < array[y - 1])): | |
array[y], array[y - 1] = array[y - 1], array[y] | |
y = y - 1 | |
return array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bubble_sort_optimized(array, decrescent=False): | |
if len(array) <= 1: | |
return array | |
for x in range(len(array) - 1): | |
swapped = False | |
for y in range(len(array) - x - 1): | |
if ((decrescent and array[y] < array[y + 1]) or | |
(not decrescent and array[y] > array[y + 1])): | |
array[y], array[y + 1] = array[y + 1], array[y] | |
swapped = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bubble_sort(array, decrescent=False): | |
if len(array) <= 1: | |
return array | |
for x in range(len(array) - 1): | |
for y in range(len(array) - x - 1): | |
if ((decrescent and array[y] < array[y + 1]) or | |
(not decrescent and array[y] > array[y + 1])): | |
array[y], array[y + 1] = array[y + 1], array[y] | |
return array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source's directive: source filename optional:if_exists | |
source ~/.slate-other-configurations if_exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bind's directives: bind key:modifiers operation parameter+ | |
bind key:modal-key operation parameter+ | |
# Location - Sets the window to the specified location. | |
bind return:shift;cmd ${full} | |
bind k:shift;cmd ${tophalf} | |
bind j:shift;cmd ${bottomhalf} | |
bind h:shift;cmd ${lefthalf} | |
bind h:shift;alt;cmd ${leftthird} | |
bind i:shift;alt;cmd ${middlethird} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default's directive: default layout-or-snapshot-name screen-configuration | |
# Triggers the twoScreenLayout when there are 2 monitors. | |
default twoScreenLayout count:2 |
NewerOlder