OpenEuphoria: Euphoria v4.1

# OpenEuphoria Manual

## Euphoria v4.1

routine or constant name search

| Up |  |  | TOC | Index
<< 5 Formal Syntax | < 6.1.22 search.ex | Up: 6 Mini-Guides | 6.1.24 where.ex > | 7 Included Tools >>

### 6.1.23 tree.ex

Count frequencies of words in standard input. Uses a binary tree to speed lookups and write an alphabetic listing to standard output.

#### 6.1.23.1 Usage

    eui tree < file1

You can direct standard output to a file with '>'

#### 6.1.23.2 How it Works

tree.ex reads in words from a text file and inserts them alphabetically into a Euphoria sequence that is being used as a "tree". The tree data structure is created by nesting sequences inside one another to whatever depth is required. Looking up a word in a tree is generally faster than searching through a linear list, since unless the tree is very lop-sided, we should have fewer comparisons to make.

| Up |  |  | TOC | Index
<< 5 Formal Syntax | < 6.1.22 search.ex | Up: 6 Mini-Guides | 6.1.24 where.ex > | 7 Included Tools >>