This file contains 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
[global] | |
realm = mma-laptop | |
# Workgroup = имя NT-домена (или рабочей группы): | |
workgroup = WORKGROUP | |
# NetBIOS-имя, под которым будет виден сервер остальным машинам сети. | |
netbios name = NAU | |
# Комментарий, появляющийся рядом с именем машины в "Сетевом окружении" Windows. | |
server string = mma-laptop-samba |
This file contains 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
#!/bin/zsh | |
HISTFILE=~/.histfile | |
HISTSIZE=1000000 | |
SAVEHIST=100000 | |
bindkey -e | |
# completion | |
autoload -U compinit | |
compinit |
This file contains 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
class Array | |
def self.split(array) | |
left = [] | |
right = [] | |
length = array.length | |
if length.odd? | |
left = array.first(length / 2 + 1) | |
else | |
left = array.first(length / 2) | |
end |
This file contains 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
class Array | |
def insertion_sort_imperative | |
self.each_index do |j| | |
v = self[j] | |
i = j - 1 | |
while (i >= 0) and (self[i] > v) do | |
self[i], self[i + 1] = self[i + 1], self[i] | |
i = i - 1 | |
end | |
self[i + 1] = v |
This file contains 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
import Data.List | |
merge :: Ord a => [a] -> [a] -> [a] | |
merge x [] = x | |
merge [] y = y | |
merge (x:xs) (y:ys) = case compare x y of | |
LT -> x : merge xs (y:ys) | |
_ -> y : merge (x:xs) ys | |
mergesort :: Ord a => [a] -> [a] |
This file contains 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
import Data.List | |
bubble :: Ord a => [a] -> [a] | |
bubble [] = [] | |
bubble [x] = [x] | |
bubble (x:x':xs) = case compare x x' of | |
GT -> x' : bubble (x:xs) | |
_ -> x : bubble (x':xs) | |
bubblesort :: Ord a => [a] -> [a] |
This file contains 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
class Array | |
def left(i) | |
2 * i + 1 | |
end | |
def right(i) | |
2 * i + 2 | |
end | |
def heapify(i, heapsize) |
This file contains 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
import Data.List | |
swap :: Int -> Int -> [a] -> [a] | |
swap i j xs | i == j = xs | |
swap i j xs | otherwise = initial ++ (xs !! b) : middle ++ (xs !! a) : end | |
where [a,b] = sort [i,j] | |
initial = take a xs | |
middle = take (b-a-1) (drop (a+1) xs) | |
end = drop (b+1) xs |
This file contains 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
class PQueue | |
def initialize | |
@a = [] | |
@heapsize = 0 | |
end | |
def left(i) | |
2 * i + 1 | |
end |
This file contains 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
qsort :: Ord a => [a] -> [a] | |
qsort [] = [] | |
qsort (x:xs) = qsort lesser ++ [x] ++ qsort greater | |
where | |
lesser = filter (< x) xs | |
greater = filter (>= x) xs |
OlderNewer