Description

Returns the left node of a given node.

The index of the left node of a specified node is calculated as being:

$$
\text{index(left node)} = 2*\text{index(specified node)}+1
$$

Code

This script was tested and works on OpenSim version 0.7.5!

///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
string wasBinaryTreeLeft(list BT, string node) {
    // Left child index: 2*i + 1
    integer i = llListFindList(BT, (list)node);
    if(i == -1) return "";
    return llList2String(BT, 2*i+1);
}

secondlife/binary_trees/left.txt · Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor


For the copyright, license, warranty and privacy terms for the usage of this website please see the license and privacy pages.