






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of perl hashes and their functionality. It also introduces the concept of trees, explaining their importance and various types, including decision trees, expression trees, and binary search trees. These data structures enable efficient searching and easier manipulation than graphs.
Typology: Study notes
1 / 10
This page cannot be seen from the preview
Don't miss anything!







So far, we've found out that Perl hashes can do most anything. But how do they work? Key to how hashes work: associating a key with a value. How do Perl hashes work? How do hashes work? Docsity.com
A simplification of graphs No cycles Undirected edges. Trees A specific node (vertex) is the root. (could in theory be any node). Rooted trees Represent divide-and-conquer processes. Represent decisions/probabilities. Enable efficient searching. Easier to manipulate than graphs. Why trees are important: Trees Docsity.com
Represent divide-and-conquer processes. Represent decisions/probabilities. Enable efficient searching. Easier to manipulate than graphs. Why trees are important: Why trees are important Docsity.com
Decision trees: represent decisions in a process Search trees: store data for easy retrieval. Syntax trees: describe how a computer language works. Kinds of trees Docsity.com
Example of a decision tree Docsity.com
Depict the order in which expressions are computed. Expression trees Start with whole expression. Choose the operator with least precedence. The left-hand side of the operator expression (left child). The operator (root) The right-hand side of the operator expression (right child). Split the expression into three parts: Repeat for children! One way to produce an expression tree: recursive-descent parsing Expression trees Docsity.com
Can store key/value pairs for quick retrieval By divide-and-conquer. In O(log n) time (n=# of pairs) Binary search trees Every node has at most two children. Every node corresponds to a search key and value. The left child's key is less than the node's key. The right child's key is greater than the node's key. For every node in the tree: Tree structure: Binary search trees. Docsity.com