Tree data structure

In computer science, a tree is a widely-used computer data structure that emulates a tree structure with a set of linked nodes. Each node has zero or more child nodes, which are below it in the tree (in computer science, unlike in nature, trees grow down, not up). The node of which a node is a child is called its parent node. A child has at most one parent; a node without a parent is called the root node (or root). Nodes with no children are called leaf 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.

In a tree data structure, there is no distinction between the various children of a node --- none is the "first child" or "last child". A tree in which such distinctions are made is called an ordered tree, and data structures built on them are called ordered tree data structures. Ordered trees are by far the commonest form of tree data structure.

Binary trees are one kind of ordered tree, and there is a one-to-one mapping between binary trees and general ordered trees.

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).

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 where the operation happens to a node before it happens to its children is called a breadth first walk; a walk where the children are operated upon before the parent is called a depth first walk.

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:

Examples

Related Terms



In the News

Temperature Control Improves NIST X-ray Detector
Researchers at the National Institute of Standards and Technology (NIST) have developed an improved experimental X-ray detector that could pave the way to a new generation of wide-range, high-resolution trace chemical analysis instruments.

Gallery: Windows Vista Tour
See screenshots of the Ultimate version of the new, visually sleek Microsoft operating system before you make the upgrade leap. By Bruce Gain.

Oncology: A 'Neu'Protein Target In The Treatment Of Breast Cancers
Overexpression of the protein EphA2 in aggressive breast cancer is common, and generally leads to poor outcome for the patient. However, the function of Eph2A in cancer progression is controversial, with conflicting evidence suggesting both pro- and anti-cancer roles for the protein. Scientists have now presented evidence that the role Eph2A in breast cancer is highly context dependent.

Recreational drug use is related to impulsive behavior, Spanish resear
Psychologists in Spain have just concluded a study regarding the use of addictive substances by young university students and the manifestation of impulsive behavior in the same group of people, on a cognitive and psychomotor level. The findings suggest that regular consumers of cannabis and alcohol are more impulsive than non-users. However, there is no evidence of the differences between both of these consumer groups, which makes these experts believe that "consuming these substances, whatever their nature, is related to impulsivity."

Why Humans Walk On Two Legs
A team of anthropologists that studied chimpanzees trained to use treadmills has gathered new evidence suggesting that our earliest apelike ancestors started walking on two legs because it required less energy than getting around on all fours. The researchers found that human walking used about 75 percent less energy and burned 75 percent fewer calories than quadrupedal and bipedal walking in chimpanzees. They also found that for some but not all of the chimps, walking on two legs was no more costly than knucklewalking.

Making Robotic Movement Of Goods More 'Pallet-able'
Under a cooperative research and development agreement with Transbotics, a Charlotte, N.C., AGV manufacturer, NIST is developing advanced sensor processing and modeling algorithms to help robot forklifts verify the location and orientation of pallets laden with goods.

Study Casts Doubt On Lung Treatment For Preterm Infants
Contrary to an earlier finding, inhaled nitric oxide therapy (a treatment for lung problems in premature infants) does not reduce the infant's chances for death or further lung problems, according to a study by the National Institute of Child Health and Human Development of the National Institutes of Health.

What's The Backscatter Of Your Beer? Ultrasound Technology Tracks Micr
An acoustic technology developed at Pacific Northwest National Laboratory eliminates the need for laborious and costly sampling of slurries in large containers. Fermentation-based industries, such as beer and pharmaceuticals, could benefit from the technology's noninvasive, continuous and objective "listening"technique in tracking microbial growth through the different process phases. The lab's patented technique is novel in its fusion of information extracted from both acoustic backscatter and transit measurements, including velocity, amplitude and frequency data.

Superheavy Element 114 Confirmed: A Stepping Stone To The 'Island Of S
Scientists at the US Department of Energy's Lawrence Berkeley National Laboratory have confirmed the production of the superheavy element 114, ten years after a group at the Joint Institute for Nuclear Research in Dubna, Russia, first claimed to have made it. The search for 114 has long been a key part of the quest for nuclear science's hoped-for Island of Stability.

Dopey Red Glass
Color shifting glass




MP3 Music Downloads

Preview songs, Download Free Music,Burn CDs at ITunes.com
iTunes_RGB_9mm

 


Google




InformationQuickFind.com - Find Information Fast

Links | Privacy Policy | News |