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 class invariants assertion, What is Class invariants assertion ...

What is Class invariants assertion A class invariant is an assertion which should be true of any class instance before and after calls of its exported operations. Generally

Explain dijkstra''s algorithm, Explain Dijkstra's algorithm Dijkstra's ...

Explain Dijkstra's algorithm Dijkstra's algorithm: This problem is concerned with finding the least cost path from an originating node in a weighted graph to a destination node

Sparse matrix, How sparse matrix stored in the memory of a computer?

How sparse matrix stored in the memory of a computer?

Time converstion, how to convert 12 hour format into 24 hour format using c...

how to convert 12 hour format into 24 hour format using c program

Explain backtracking, Explain Backtracking The  principal idea is to co...

Explain Backtracking The  principal idea is to construct solutions single component  at a time  and evaluate such  partially constructed candidates as follows. If a partiall

Darw a flowchart that inputs country someone is visiting, Regis lives in Br...

Regis lives in Brazil and frequently travels to USA, Japan and Europe. He wants to be able to convert Brazilian Reais into US dollars, European euros and Japanese yen. Conversion f

Graphs, floyd warshall algorithm

floyd warshall algorithm

C, padovan string

padovan string

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