If you understand the concept then an implementation isn't terribly difficult with a little effort on your part. So go do your own homework. We won't bail you out. kthxbye.
any simple example?
No. In my experience, people asking for "simple" examples of something reasonably complex don't understand the simplest example possible and then continue to ask for explanations and excessive hand holding. It's a waste of time to type up the example in the first place, so I don't do it anymore unless you show promise.
This is a very basic example. Then you must implement the addNode, traverseTree, searchTree
and other functions to use the structure. When implementing a tree you will need a lot of recursion or stack in order to traverse, search and to use other features that tree offers.
Even the most basic of basic examples will use an array to store links. Once you get beyond two links (even there an array is helpful), it becomes exponentially more tedious to work with nodes. Just an FYI.
Since I generally use binary trees it is a habit for me to declare the pointers seperately.
I did that for a while before realizing that it's cleaner to use an array even for binary trees. Instead of manually writing two symmetric cases for the left and right link, you can roll that up into one case and use a simple calculation to determine which index you want. I've found this to be absolutely invaluable when the symmetric cases start getting larger, such as with balanced binary search trees.
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...