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

Pacemakers And Defibrillators For The Survival Of Patients Suffering F
Studies recently carried out at the University Hospital of the University of Navarra show that cardiac resynchronisation therapy using pacemakers and defibrillators improves the survival and quality of life of patients suffering from heart insufficiency and disorders of the blood-flow system.

Center for Space Science and Applied Research, Chinese Academy of Scie
Background and news from this Chinese facility researching space science topics in areas such as space engineering technology, space physics, and weather exploration. Find overviews of research areas and projects, news about China's space program, such as the first successful moon photo captured by its lunar probe project (November 2007), and announcements of conferences. In Chinese and English (occasional translation errors).

Biocontrol Of Invasive Water Hyacinth Contributes To Socioeconomic And
Scientists have implemented a successful bioeradication program of an invasive water weed in Africa's Lake Victoria. Two insect biocontrol species, weevils in the genus Neochetina, were used, along with mechanical removal, to control the highly invasive water hyacinth, which has also plagued waterways in the southern United States.

Hotspots Or Not? Isotopes Score One For Traditional Theory
New chemical evidence sheds light on the physical constraints of 'hotspots' -- locations where upwellings of Earth's mantle material form seamounts and island chains. Although the existence of hotspots has been debated over the past 30 years, consistent data from uranium isotope decay series at eight island locations supports the idea that concentrated plumes of hot mantle material formed these islands.

Melatonin Supplements Offer Little Or No Benefit For The Sleep Deprive
The U.S. Department of Health and Human Services has released information aboutresearch on melatonin supplements. The research was conducted at the University of Alberta for the U.S. National Center for Complementary and Alternative medicine. U of A researchers did a comprehensive review of all studies on the use of melatonin supplements to treat sleep disorders.

In Solution, Tiny Magnetic Wires Scatter Light
Maneuvering external magnets, scientists can command the direction in which light bounces off tiny, magnetic wires that sway like matchsticks in thick, slow-moving solutions.

Variation In 3 Genes Influences Risk Of Age-related Macular Degenerati
Researchers in Boston have discovered a new common, noncoding variant in the Complement Factor H (CFH) gene that is associated with age-related macular degeneration (AMD), the leading cause of irreversible visual impairment and blindness among persons aged 60 and older. Their analyses, for the first time, combine this new variant with all previously reported variants to estimate individual risk of advanced AMD.

Drought Reduces Nitrogen-fixing In Legumes
In drought conditions, the capacity for retaining carbon in legume nodules is limited and this may be the reason why there is a drop in nitrogen-fixing in legumes under these conditions.

Software 'Agents' Could Help Unmask Reality Of Disease Clusters
Concerns over the privacy of patients could be hampering efforts to spot disease clusters and monitor the health effects of environmental pollution, according to researchers in the latest edition of the Journal of Biomedical Informatics.

Knights of the chemical realm
Right royal honours were bestowed on two of my very oldest contacts in the field of chemistry this week. Royal Society of Chemistry president Professor Jim Feast was awarded the CBE in the New Year Honours List for “services to polymer chemistry.” And, supramolecular ex-pat Fraser Stoddart was given a Knighthood for to “services to [...]




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 |