Suppose that you have been asked to consider creating tree structures for something like beverages (Shown in image 1) In this case you will need to consider writing a function to create such tree in Kotlin. Moreover, you will need to traverse the tree in at least two ways (e.g. Depth-First Traversal and Breadth-First Traversal). In addition you will need the following functionality: (a) Generic Function to search for an element in a tree (b) Delete an element from tree (c) Add element to the tree (d) Count Leaves (e) Size of the tree (f) Testing if the tree is balanced Finally, you will need to adjust the creation of the general tree to a Trie Tree. The trie (pronounced try) is a tree that specializes in storing data that can be represented as a collection, such as English words (Shown in image 2): In this case, you will need to develop different associated function to do the followings: 1. Insert a new element in a trie 2. Test if the trie contains an element
Suppose that you have been asked to consider creating tree structures for something like beverages (Shown in image 1)
In this case you will need to consider writing a function to create such tree in Kotlin. Moreover, you will need to traverse the tree in at least two ways (e.g. Depth-First Traversal and Breadth-First Traversal). In addition you will need the following functionality:
(a) Generic Function to search for an element in a tree
(b) Delete an element from tree
(c) Add element to the tree
(d) Count Leaves
(e) Size of the tree
(f) Testing if the tree is balanced
Finally, you will need to adjust the creation of the general tree to a Trie Tree. The trie (pronounced try) is a tree that specializes in storing data that can be represented as a collection, such as English words (Shown in image 2):
In this case, you will need to develop different associated function to do the followings:
1. Insert a new element in a trie
2. Test if the trie contains an element
Step by step
Solved in 3 steps