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

What is an unreachable code assertion, What is an unreachable code assertio...

What is an unreachable code assertion An unreachable code assertion can be placed at the default case; if it's every executed, then program is in an erroneous state. A loop in

Order of linear search, a. In worst case the order of linear search is O (n...

a. In worst case the order of linear search is O (n/2) b. Linear search is more competent than Binary search. c. For Binary search, the array must be sorted in ascending orde

State the example of pre- and post-conditions, State the example of pre- an...

State the example of pre- and post-conditions Suppose that function f(x) should have a non-zero argument and return a positive value. We can document these pre- and post-condit

For loop, for (i = 0; i sequence of statements } Here, the loop e...

for (i = 0; i sequence of statements } Here, the loop executes n times. Thus, the sequence of statements also executes n times. Since we suppose the time complexity of th

Encryption the plain-text using the round keys, Encryption the plain-text u...

Encryption the plain-text using the round keys: 1. (Key schedule) Implement an algorithm that will take a 128 bit key and generate the round keys for the AES encryption/decryp

Er diagram, Ask queConsider the following functional dependencies: Applican...

Ask queConsider the following functional dependencies: Applicant_ID -> Applicant_Name Applicant_ID -> Applicant_Address Position_ID -> Positoin_Title Position_ID -> Date_Position_O

Design a time algorithm, Q. An, array, A comprises of n unique integers fro...

Q. An, array, A comprises of n unique integers from the range x to y(x and y inclusive where n=y-x). Which means, there is only one member that is not in A. Design an O(n) time alg

Ruby implementation of the symbol abstract data type, Ruby implementation o...

Ruby implementation of the Symbol ADT Ruby implementation of the Symbol ADT, as mentioned, hinges on making Symbol class instances immutable that corresponds to the relative la

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