Binary Tree Template Class C/C++ script

SPONSORED LINKS

    Specification

  • Version:
  • File size: 0 KB
  • File name: snippet239.htm
  • Last update:
  • Platform: Windows / Linux / BSD / Solaris
  • Language: C/C++
  • Price:Freeware
  • Company: Dark_Nexus (View more)

Binary Tree Template Class script description:




Publisher review:
Binary Tree Template Class - A template class for binary trees A template class for binary trees.

Binary Tree Template Class Overview NOTE: Paramters marked with an * are paramters for overloaded functions Constructors(...) Description: Constructs a tree from an array of data, or will assign it's root to another tree as a copy Parameters: *_leaf = assign the root of the tree to a leaf of another tree *_bintree = assign the root of the tree to the root of another tree *_data = an array of data to be sorted *thisisaCopy = If set to true, then when the tree's destructor is ecountered, it will not delete the memory DestroyTree(...) Description: De-allocates all memory tied to the tree and set's all nodes to idle Parameters: *node = The node at which to start the destruction MakeTree(...) Description: Constructs and sorts a binary tree from the passed data array Parameters: value = a pointer to the array of data to be sorted FindLeaf(...) Description: Searches the binary tree for the passed piece of data Parameters: value = The value in which to be searched for Returns: A pointer to the leaf containing "value" if that value is found GetRoot() Description: Retrieves the leaf for the root of the tree Returns: A pointer to the root leaf DestroyLeaf(...) Description: Removes the specified leaf or value from the tree Parameters: node = The node to be removed *value = The value to be removed, if found GetMin(...) Description: Finds the minimum value of the tree from the specified leaf Parameters: *leaf = The leaf at which to start searching Returns: The minimum data value of the tree GetMinLeaf(...) Description: Finds the leaf that contains the minimum value of the tree Parameters: *value = The value at which to start searching Returns: A pointer to the leaf that contains the minimum value GetMax(...) Description: Finds the maximum value of the tree Parameters: *leaf = The leaf at which to start searching Returns: The maximum data vlue of the tree GetMaxLeaf(...) Description: Finds the leaf that contains the maximum value of the tree Parameters: *value = The value at which to start searching Returns: A pointer to the leaf that contains the maximum value GetSize(...) Description: Finds the number of leafs in the entire tree Parameters: *leaf = The leaf at which to start searching *value = The value at which to start searching Returns: The number of total leafs in the tree, in integer form GetDepth(...) Description: Finds the farthest reaching leaf from the specified leaf Parameters: *leaf = The leaf at which to start searching *value = The value at which to start searching Returns: The maximum depth of the tree as an integer AddLeaf(...) Description: Appends a piece of data to the tree Parameters *leaf = The leaf at which to start appending When using your own datatype such as structures, be sure to make operator functions for < and > Example: struct mydata { int var; bool operator < (mydata compare) { if (var < compare.var) return true; else return false; } };
Binary Tree Template Class is a C/C++ script for Snippets scripts design by Dark_Nexus. It runs on following operating system: Windows / Linux / BSD / Solaris.

Operating system:
Windows / Linux / BSD / Solaris

Latest script and internet news

222

222

22

Posted on: 18 Jul 2023 22:27 by A. Brown

111

111

111

Posted on: 18 Jul 2023 22:24 by A. Brown

The permanently active Push system offered by the new Google Chrome 42

The permanently active Push system offered by the new Google Chrome 42

Hacked By !Sc-sT

Posted on: 17 Mar 2015 07:57 by A. Brown

SPREAD THE WORD

User Rating


Rating: 2.2 out of 5
Based on 13 ratings. 13 user reviews.

  • Currently 2.15 out of 5
  • 1
  • 2
  • 3
  • 4
  • 5