A simple example binary tree In computer science, a **tree** is a widely-used computer data structure that emulates a tree structure with a set of linked nodes. It is a special case of a graph. Each node has zero or more **child nodes**, which are below it in the tree (by convention in computer science, trees grow down - not up as they do in nature). A node that has a child is called the child's **parent node**. A child has at most one parent; The topmost node in a tree is called the **root node**. Being the topmost node, the root node will not have parents. Nodes at the bottom most level of the tree are called **leaf nodes**. Since they are at the bottom most level, they will not have any children. Image File history File links Please see the file description page for further information. ...
A parent node (or ancestor node) is a node in a tree data structure that links to one or more child nodes. ...
In computer science, an internal node or inner node is any node of a tree data structure that is not a leaf node. ...
A root node is a specially chosen node in a tree data structure at which all operations on the tree begin. ...
A subtree is a portion of a tree data structure that can be viewed as a complete tree in itself. ...
Image File history File links Binary_tree. ...
Image File history File links Binary_tree. ...
A binary tree, a simple type of branching linked data structure. ...
A tree structure is a way of representing the hierarchical nature of a structure in a graphical form. ...
Computer science, or computing science, is the study of the theoretical foundations of information and computation and their implementation and application in computer systems. ...
A parent node (or ancestor node) is a node in a tree data structure that links to one or more child nodes. ...
A root node is a specially chosen node in a tree data structure at which all operations on the tree begin. ...
In computer science, a leaf node is a node of a tree data structure that has zero child nodes. ...
In graph theory, a tree is a connected acyclic graph. A rooted tree is such a graph with a vertex singled out as the root. In this case, any two vertices connected by an edge inherit a parent-child relationship. An acyclic graph with multiple connected components or a set of rooted trees is sometimes called a forest. A labeled graph with 6 vertices and 7 edges. ...
A labeled tree with 6 vertices and 5 edges In graph theory, a tree is a graph in which any two vertices are connected by exactly one path. ...
There are two basic types of trees. In an **unordered tree**, a tree is a tree in a purely structural sense - that is to say, given a node, there is no order for the children of that node. A tree on which an order is imposed -- for example, by assigning different natural numbers to each child of each node -- is called an **ordered tree**, and data structures built on them are called ordered tree data structures. Ordered trees are by far the most common form of tree data structure. Natural number can mean either a positive integer (1, 2, 3, 4, ...) or a non-negative integer (0, 1, 2, 3, 4, ...). Natural numbers have two main purposes: they can be used for counting (there are 3 apples on the table), or they can be used for ordering (this is...
In computer science, a tree is a widely-used computer data structure that emulates a tree structure with a set of linked nodes. ...
Binary search trees are one kind of ordered tree, and there is a one-to-one mapping between binary trees and general ordered trees. A binary search tree of size 9 and depth 3, with root 7 and leaves 1, 4, 7 and 13. ...
There are many different ways to represent trees; common representations represent the nodes as records allocated on the heap with pointers to their children, their parents, or both, or as items in an array, with relationships between them determined by their positions in the array (e.g., binary heap). It has been suggested that this article or section be merged with Memory allocation. ...
In computer programming, an array, also known as a vector or list (for one-dimensional arrays) or a matrix (for two-dimensional arrays), is one of the simplest data structures. ...
Binary heaps are a particularly simple kind of heap data structure created using a binary tree. ...
Stepping through the items of a tree, by means of the connections between parents and children, is called **walking the tree**, and the action is a **walk** of the tree. Often, an operation might be performed when a pointer arrives at a particular node. A walk in which each parent node is traversed before its children is called a **pre-order walk**; a walk in which the children are traversed before their respective parents are traversed is called a **post-order walk**. See tree traversal for a discussion of pre-order, in-order and post-order traversal. In computer science, tree traversal is the process of visiting each node in a tree data structure. ...
Common operations on trees are: - Enumerating all the items;
- Searching for an item;
- Adding a new item at a certain position on the tree;
- Deleting an item;
- Removing a whole section of a tree (called
**pruning**); - Adding a whole section to a tree (called
**grafting**); - Finding the root for any node.
Common uses for trees are to: A hierarchy (in Greek hieros = sacred, arkho = rule) is a system of ranking and organizing things. ...
In computer science, a search algorithm, broadly speaking, is an algorithm that takes a problem as input and returns a solution to the problem, usually after evaluating a number of possible solutions. ...
Tree search algorithms are specialized versions of graph search algorithms, which take the properties of trees into account. ...
In computer science and mathematics, a sorting algorithm is an algorithm that puts elements of a list in a certain order. ...
## See also
Binary space partitioning (BSP) is a method for recursively subdividing a space into convex sets by hyperplanes. ...
In computer science, a heap is a specialized tree-based data structure that satisfies the heap property. ...
A labeled tree with 6 vertices and 5 edges In graph theory, a tree is a graph in which any two vertices are connected by exactly one path. ...
Tree search algorithms are specialized versions of graph search algorithms, which take the properties of trees into account. ...
In set theory, a tree is a partially ordered set (poset) (T, <) such that for each t Îµ T, the set {s Îµ T : s < t} is well-ordered by the relation <. For each t Îµ T, the order type of {s Îµ T : s < t} is called the idxheight, or height of t...
A tree structure is a way of representing the hierarchical nature of a structure in a graphical form. ...
An exponential tree is almost identical to a [binary search tree], with the exception that the dimension of the tree is not the same at all levels. ...
## References - Donald Knuth.
*The Art of Computer Programming: Fundamental Algorithms*, Third Edition. Addison-Wesley, 1997. ISBN 0-201-89683-4 . Section 2.3: Trees, pp.308–423. - Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein.
*Introduction to Algorithms*, Second Edition. MIT Press and McGraw-Hill, 2001. ISBN 0-262-03293-7 . Section 10.4: Representing rooted trees, pp.214–217. Chapters 12–14 (Binary Search Trees, Red-Black Trees, Augmenting Data Structures), pp.253–320. Donald Knuth at a reception for the Open Content Alliance. ...
Thomas H. Cormen is the co-author of Introduction to Algorithms, along with Charles Leiserson, Ron Rivest, and Cliff Stein. ...
Charles Leiserson is a computer scientist, specializing in the theory of parallel computing and distributed computing, and particularly practical applications thereof; as part of this effort, he developed the Cilk multithreaded language. ...
Professor Ron Rivest Professor Ronald Linn Rivest (born 1947, Schenectady, New York) is a cryptographer, and is the Viterbi Professor of Computer Science at MITs Department of Electrical Engineering and Computer Science. ...
Clifford Stein is a computer scientist, currently working as a professor at Columbia University in New York, NY. He earned his BSE from Princeton University in 1987, a MS from Massachusetts Institute of Technology in 1989, and a PhD from Massachusetts Institute of Technology in 1992. ...
Introduction to Algorithms is a book by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. ...
## External links |