private void updateParentsFree(int id) {
        int logChild = depth(id) + 1;
        while (id > 1) {
            int parentId = id >>> 1;
            byte val1 = value(id);
            byte val2 = value(id ^ 1);
            logChild -= 1; // in first iteration equals log, subsequently reduce 1 from logChild as we traverse up

            if (val1 == logChild && val2 == logChild) {
                setValue(parentId, (byte) (logChild - 1));
            } else {
                byte val = val1 < val2 ? val1 : val2;
                setValue(parentId, val);
            }

            id = parentId;
        }
    }
private void updateParentsFree ( int id ) { int logChild = depth ( id ) + 1 ; while ( id > 1 ) { int parentId = id > > > 1 ; byte val1 = value ( id ) ; byte val2 = value ( id ^ 1 ) ; logChild -= 1 ; if ( val1 == logChild && val2 == logChild ) { setValue ( parentId , ( byte ) ( logChild - 1 ) ) ; } else { byte val = val1 < val2 ? val1 : val2 ; setValue ( parentId , val ) ; } id = parentId ; } }
Update method used by free
This needs to handle the special case when both children are completely free
in which case parent be directly allocated on request of size = child-size * 2

@param id id