Implementation of tree, Data Structure & Algorithms

Assignment Help:

The most common way to insert nodes to a general tree is to first discover the desired parent of the node you desire to insert, and then insert the node to the parent's child list. The most common implementations add the nodes one at a time, however since each node can be considered a tree on its own, other implementations build up a whole sub-tree before adding it to a larger tree. As the nodes are inserted & deleted dynamically from a tree, tree is frequently implemented by link lists. Though, it is simpler to write algorithms for data representation where the numbers of nodes are fixed. Figure illustrated the structure of the node of a general k-ary tree.

921_IMPLEMENTATION OF TREE.png

Figure: Node structure of a general k-ary tree

2271_IMPLEMENTATION OF TREE1.png

 Figure: A linked list representation of tree (3-ary tree)

Figure illustrates a tree with one data element & three pointers. The number of pointers needed to implement a general tree depends of the maximum degree of nodes into the tree.


Related Discussions:- Implementation of tree

Cohen sutherland algorithm, Using the cohen sutherland. Algorithm. Find the...

Using the cohen sutherland. Algorithm. Find the visible portion of the line P(40,80) Q(120,30) inside the window is defined as ABCD A(20,20),B(60,20),C(60,40)and D(20,40)

Calculate the k-th power and recursive algorithem, 1. The following is a r...

1. The following is a recursive algorithm to calculate the k -th power of 2. Input k a natural number Output kth power of 2 Algorithem: If k =0then return 1 Else return 2* po

Develop a material requirements plan, The below figure illustrates the BOM ...

The below figure illustrates the BOM (Bill of Materials) for product A. The MPS (Material requirements Planning) start row in the master production schedule for product A calls for

The theta-notation, This notation bounds a function to in constant factors....

This notation bounds a function to in constant factors. We say f(n) = Θ(g(n)) if there presents positive constants n 0 , c 1 and c 2 such that to the right of n 0 the value of f

Division-remainder hashing, According to this, key value is divided by any ...

According to this, key value is divided by any fitting number, generally a prime number, and the division of remainder is utilized as the address for the record. The choice of s

Representation of linked list in memory, Representation of Linked list in M...

Representation of Linked list in Memory:- Each node has an info part and a pointer to the next node also known as link. The number of pointers is two in case of doubly linked

Optimization Methods, Optimal solution to the problem given below. Obtain t...

Optimal solution to the problem given below. Obtain the initial solution by VAM Ware houses Stores Availibility I II III IV A 5 1 3 3 34 B 3 3 5 4 15 C 6 4 4 3 12 D 4 –1 4 2 19 Re

Hashing and five popular hashing functions, Q. Explain the term hashing? Ex...

Q. Explain the term hashing? Explain any five well known hash functions.                         Ans: Hashing method provides us the direct access of record from the f

Dqueue, algorithm of output restricted queue.

algorithm of output restricted queue.

Sorted list followed by a few "random" elements, You have to sort a list L ...

You have to sort a list L having of a sorted list followed by a few "random" elements. Which sorting methods would be especially suitable for this type of task?   Insertion sort

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd