Skip to main content

Avl.pre_order

Conduct a pre order traversal of the tree and output the result in a list

Usage

pre_order()

Returns:
      list
            List of pre order sequence

Example

from jellybeans.structures import Avltree = Avl(lambda x,y: len(x) >= len(y))tree.insert("abcd")tree.insert("a")tree.insert("aaaaaaa")tree.insert("aac")print(tree.pre_order()) # ['abcd', 'a', 'aac', 'aaaaaaa']