Skip to content

Instantly share code, notes, and snippets.

View c4x1's full-sized avatar
๐ŸŒ€
home->work->home->work;

CSpornov c4x1

๐ŸŒ€
home->work->home->work;
  • Russian
View GitHub Profile
'use strict';
/*
* Binary search tree with in-order iteration.
* http://greim.github.io/gen/dist/00-intro.html
*/
class Tree {
add(value) {
if (this.root) this.root.add(value);
'use strict';
function BinarySearchTree() {
this.root = null;
}
BinarySearchTree.prototype.insertNode = function (val) {
var node = {
data : val,
@c4x1
c4x1 / bst.es6
Created May 20, 2019 11:10 — forked from jochasinga/bst.es6
Binary search tree implemented in ES6
'use strict';
class Node {
constructor(data) {
this.data = data;
this.left = undefined;
this.right = undefined;
}
@c4x1
c4x1 / btree.js
Created May 20, 2019 11:07 — forked from marcin-chwedczuk/btree.js
BTree implementation in JavaScript
#!/usr/bin/env node
const NKEYS = 4;
function arrayOfSize(size) {
var a = Array(size);
for (var i = 0; i < size; i += 1)
a[i] = null;