Skip to content

Instantly share code, notes, and snippets.

@char16t
char16t / avl-tree.el
Created April 5, 2019 12:57
AVL tree on Emacs Lisp
;; AVL-tree
(defun avltree-create-node (key)
(list key 1 nil nil))
(defun avltree-height (node)
(if (eq node nil)
0
(nth 1 node)))
(defun avltree-bfactor (node)
@char16t
char16t / voronoi.clj
Last active April 5, 2019 12:55
Simplest implementation of Voronoi diagram on Clojure
(ns voronoi-clojure.core
(:gen-class)
(:import (java.io File)
(javax.imageio ImageIO)
(java.awt.image BufferedImage)
(java.awt.geom Ellipse2D Ellipse2D$Double)
(java.awt Color)))
(defn- distance [x1 x2 y1 y2]
(Math/sqrt (+ (* (- x1 x2) (- x1 x2)) (* (- y1 y2) (- y1 y2)))))