help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating a binary trees


From: Martin Helm
Subject: Re: creating a binary trees
Date: Sat, 19 Nov 2011 02:48:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0

Am 19.11.2011 02:22, schrieb Faizal:
> Is there any octave program sample that I can use to start up in creating a
> binary trees for data structure. Thank you.
I am not absolutely sure what you are looking for exactly, you can build
tree structures in octave with cell arrays, like that
tree =
{{{{1},{2}},{{3},{4}}},{{{5},{6}},{{7},{8}}}}                                   

tree
=                                                                               
             

{                                                                               
                  

  [1,1] =
 
{                                                                               
                

    [1,1]
=                                                                               
        

   
{                                                                               
              

      [1,1]
=                                                                               
      

      {
        [1,1] =  1
      }
      [1,2] =
      {
        [1,1] =  2
      }
    }
    [1,2] =
    {
      [1,1] =
      {
        [1,1] =  3
      }
      [1,2] =
      {
        [1,1] =  4
      }
    }
  }
  [1,2] =
  {
    [1,1] =
    {
      [1,1] =
      {
        [1,1] =  5
      }
      [1,2] =
      {
        [1,1] =  6
      }
    }
    [1,2] =
    {
      [1,1] =
      {
        [1,1] =  7
      }
      [1,2] =
      {
        [1,1] =  8
      }
    }
  }
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]