build/module/RBTree.js
function diamondLeftToVic(lead) {
    var m = lead.p;
    var z = lead;
    var x = z.l;
    var y = x.r;
    var a = y.l;
    var b = y.r;
    x.flag = false;
    y.l = x;
    x.p = y;
    y.r = z;
    z.p = y;
    x.r = a;
    a.p = x;
    z.l = b;
    b.p = z;
    if (m.r === lead) {
        m.r = y;
    }
    else {
        m.l = y;
    }
    y.p = m;
    return y;
}
function diamondLeftToVic(lead) {
    var m = lead.p;
    var z = lead;
    var x = z.l;
    var y = x.r;
    var a = y.l;
    var b = y.r;
    x.flag = false;
    y.l = x;
    x.p = y;
    y.r = z;
    z.p = y;
    x.r = a;
    a.p = x;
    z.l = b;
    b.p = z;
    if (m.r === lead) {
        m.r = y;
    }
    else {
        m.l = y;
    }
    y.p = m;
    return y;
}
function diamondLeftToVic ( lead ) { var m = lead . p ; var z = lead ; var x = z . l ; var y = x . r ; var a = y . l ; var b = y . r ; x . flag = false ; y . l = x ; x . p = y ; y . r = z ; z . p = y ; x . r = a ; a . p = x ; z . l = b ; b . p = z ; if ( m . r === lead ) { m . r = y ; } else { m . l = y ; } y . p = m ; return y ; }
z, x, y are in diamond-left formation.
z is the initial leader and is black.
x and y are initially red.

z moves right and back.
y takes the lead.
children a,b of y are adopted by x and z.
x becomes black.

z          y
x    =>    x     z
y        a   b
a   b
z x y are in diamond - left formation . z is the initial leader and is black . x and y are initially red .