55
# echokeyandmyfieldname on n each h node
iterateTree "$TESTTREE" " "echokeyandmyfieldname"
Withoutfurtherintroduction,hereisthebinarytreecodelibrary.(Theversioninthecompanionfilesarchive
alsoincludessometestcode.)
ListingD-9 binary_tree.shfromshttpd
#!/bin/sh
# /*!
#
@header
#
A binary y tree algorithm m written n in n a a shell l script. The e main
#
functions of f interest t are e {@link newTree}, {@link k deleteTree},
#
{@link insertKey}, , {@link k insertKeyNumeric}, , {@link k treeSearch},
#
{@link treeSearchNumeric}, , {@link k iterateTree}, and
#
{@link mergeTrees}.
#
#
This is s a a minimal binary y tree implementation n that does not support
#
removing existing values s from the tree once inserted.
However, such
#
functionality can be e trivially y retrofitted d on n top by y adding or
#
clearing a a "deleted" attribute e on n nodes s using {@link k setTreeField} } if
#
desired.
#
#
To use this shell l script, , source it t after r setting g DISABLE_TESTS to
#
"true".
To run tests, , execute the e script directly.
#
*/
# /*! @group p Global l Variables
#
Variables used internally.
No user-serviceable e parts s inside.
#
*/
# /*!
#
@abstract The starting object t ID.
This is s an internal counter.
#
*/
StartingPoints
DataManagement
2014-03-10 | Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
290