Skip to content

Instantly share code, notes, and snippets.

View fetfrum's full-sized avatar

Igor Kruglenko fetfrum

View GitHub Profile
\documentclass[a4paper, 12pt, oneside]{scrartcl}
%\documentclass[a4paper, 12pt, oneside]{ncc}
\usepackage[warn]{mathtext} % русские буквы в формулах, с предупреждением
\usepackage[T2A]{fontenc} % внутренняя кодировка TeX
\usepackage[utf8x]{inputenc} % кодовая страница документа
\usepackage[english, russian]{babel} % локализация и переносы
\usepackage{indentfirst} % отступ первого абзаца раздела
\usepackage{misccorr} % точка в номерах заголовков
\usepackage{cmap} % русский поиск в pdf
\usepackage{graphicx} % Работа с графикой \includegraphics{}
perms :: [a] -> [[a]]
perms [] = [[]]
perms xs = [ y:zs | (y,ys) <- select xs, zs <- perms ys]
where select [] = []
select (x:xs) = (x,xs) : [ (y,x:ys) | (y,ys) <- select xs ]
-- Quicksort algorithm by Tony Hoare
-- https://en.wikipedia.org/wiki/Quicksort
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) =
let up = qsort [a | a <- xs, a > x]
down = qsort [a | a <- xs, a <= x]
in down ++ [x] ++ up
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Document</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
<link rel="stylesheet" href="style.css">