func (t *Tree) Count() int {
	last_row := len(t.rows) - 1
	return len(t.rows[last_row]) / 64
}
Count returns the number of items in the list this tree represents.
package id
import (
	"bytes"
	"crypto/sha512"
)
type Tree struct {
	data []byte
	rows [][]byte
}
func NewTree(s DigestSlice) *Tree {
	rows, data := allocateTree(len(s))
	last_row := len(rows) - 1
	for i, digest := range s {
		copy(rows[last_row][i*64:], []byte(digest))
	}
	return &Tree{
		rows: rows,
		data: data,
	}
}
func (t *Tree) IDcount() int {
	return len(t.rows[len(t.rows)-1]) / 64
}
func (t *Tree) NodeCount() int {
	return len(t.data) / 64
}
func (t *Tree) RowCount() int {
	return len(t.rows)
}
func (t *Tree) Row(i int) []Digest {
	row := t.rows[i]
	digests := make([]Digest, len(row)/64)
	for j := range digests {
		k := j * 64
		digests[j] = Digest(row[k : k+64])
	}
	return digests
}
func (t *Tree) At(row, index int) Digest {
	i := index * 64
	return Digest(t.rows[row][i : i+64])
}
func (t *Tree) Compute() Digest {
	h := sha512.New()
	for i := len(t.rows) - 2; i >= 0; i-- {
		l := len(t.rows[i+1])
		for j := 0; j < l; j += 64 * 2 {
			jj := j / 2
			if j+64 >= l {
				copy(t.rows[i][jj:], t.rows[i+1][j:j+64])
			} else {
				h.Reset()
				if bytes.Compare(t.rows[i+1][j:j+64], t.rows[i+1][j+64:j+64*2]) == 1 {
					h.Write(t.rows[i+1][j+64 : j+64*2])
					h.Write(t.rows[i+1][j : j+64])
				} else {
					h.Write(t.rows[i+1][j : j+64*2])
				}
				copy(t.rows[i][jj:], h.Sum(nil)[0:64])
			}
		}
	}
	return Digest(t.rows[0])
}
func (t *Tree) String() string {
	var out string
	for _, row := range t.rows {
		for j := 0; j < len(row); j += 64 {
			out += Digest(row[j : j+64]).ID().String()
		}
	}
	return out
}
func (t *Tree) Length() int {
	return len(t.data) / 64
}
func (t *Tree) Size() int {
	return len(t.data)
}