answersLogoWhite

0

Can you implements tree using array?

User Avatar

Anonymous

14y ago
Updated: 8/18/2019

yes you can....

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How do you represent binary tree using array?

The root of the tree is stored in array element [0]; for any node of the tree that is stored in array element [i], its left child is stored in array element [2*i], its right child at [2*i+2]


What is difference between treeset and treemap?

TreeSet internally implements Balanced Tree Structure whereas TreeMap implements Red Hat Tree Data Structure.


Data structure algorithms using C?

array,linklist,queue,stack,tree,graph etc...


Queue ADT Using Array?

implement the queue ADT using an array


Why and is not using ' and ' in reading a string using scanf?

I guess you wanted to ask, why is it scanf ("%s", array)and not scanf ("%s", &array).Well, array is by definition a pointer to the first element: array = &array[0]


Is it mandatory to use array in foreach loop C-sharp can foreach be used without array?

Foreach is for an IEnumerable, not just an array (unless you are using C# 1.1 or earlier). A collection (List, Dictionary, etc) can also generate a sequence from foreach-statement. In fact, if you have a class that is NOT an array, but it implements all the required methods of IEnumerable, it may be applied as:public class Storage: IEnumerable {...}Storage myStorage = new Storage();...Foreach (Thing stuff in myStorage){...}


Which is faster binary tree or binary search tree?

A tree doesn't do anything so it has no speed...


Describe how an array may be used to effectively represent a complete binary tree?

First you have to sort the array. Once that is done, you can use binary search to locate any value. To achieve this, start at the middle element (this represents the root of the tree). If the value you seek is here, you are done. Otherwise if it is less than this element, the value must be in the left portion of the array, otherwise it must be in the right portion of the array. Repeat the process using the appropriate sub-array, starting with the middle element of that sub-array. Eventually you will either locate the value or the sub-array will be empty, in which case the value does not exist. This is effectively the same as starting from the root of a balanced binary tree and traversing left or right through the nodes to locate your value. Each traversal eliminates half the remaining values and the node you arrive at is the root of the sub-tree where your value must reside (if it exists).


If a CBT is stored using array , then what is the parent node of element stored at index 11?

In a complete binary tree (CBT) stored using an array, the parent of an element at index i can be found at index (i-1)/2, assuming the array is 0-indexed. So for an element stored at index 11, the parent node would be stored at index (11-1)/2 = 5.


What is need to array?

Because using array you can easily access the data required


What sport could you play using kitchen implements?

dodge ball


How do you display 15 numbers in an ascending order using an array?

Sort the array then traverse the array, printing the element values as you go.