Understanding Perl Hashes and the Role of Trees in Data Structures, Study notes of Biogenetics and Computers

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

2012/2013

Uploaded on 04/29/2013

archisha
archisha 🇮🇳

4.6

(9)

78 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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?
Trees Page 1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Understanding Perl Hashes and the Role of Trees in Data Structures and more Study notes Biogenetics and Computers in PDF only on Docsity!

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