func NewMinTree(words []string) (*MinTree, error) {
	bt := mafsa.New()
	for _, w := range words {
		err := bt.Insert(w)
		if err != nil {
			return nil, fmt.Errorf("Could not insert value into MinTree: %q\n", err)
		}
	}

	bt.Finish()
	me := mafsa.Encoder{}
	bytes, err := me.Encode(bt)
	if err != nil {
		return nil, err
	}

	de := mafsa.Decoder{}
	mmt, err := de.Decode(bytes)
	if err != nil {
		return nil, err
	}

	return &MinTree{*mmt, &MinTreeNode{*mmt.Root, rune(0)}}, nil
}
// Creates a new MinTree from a sorted list of strings. The list must be
// sorted because that is what the mafsa package expects.
Creates a new MinTree from a sorted list of strings. The list must be
sorted because that is what the mafsa package expects.
// Creates a new MinTree from a sorted list of strings . The list must be // sorted because that is what the mafsa package expects .
func NewMinTree(words []string) (*MinTree, error) {
	bt := mafsa.New()
	for _, w := range words {
		err := bt.Insert(w)
		if err != nil {
			return nil, fmt.Errorf("Could not insert value into MinTree: %q\n", err)
		}
	}
	bt.Finish()
	me := mafsa.Encoder{}
	bytes, err := me.Encode(bt)
	if err != nil {
		return nil, err
	}
	de := mafsa.Decoder{}
	mmt, err := de.Decode(bytes)
	if err != nil {
		return nil, err
	}
	return &MinTree{*mmt, &MinTreeNode{*mmt.Root, rune(0)}}, nil
}
func NewMinTree ( words [ ] string ) ( * MinTree , error ) { bt := mafsa . New ( ) for _ , w := range words { err := bt . Insert ( w ) if err != nil { return nil , fmt . Errorf ( " \n " , err ) } } bt . Finish ( ) me := mafsa . Encoder { } bytes , err := me . Encode ( bt ) if err != nil { return nil , err } de := mafsa . Decoder { } mmt , err := de . Decode ( bytes ) if err != nil { return nil , err } return & MinTree { * mmt , & MinTreeNode { * mmt . Root , rune ( 0 ) } } , nil }
Creates a new MinTree from a sorted list of strings.
Creates a new MinTree from a sorted list of strings .