In: Computer Science
State a data structure that is suitable for storing
(i) the words in a dictionary to facilitate searching
(ii) the set of folders you have in your computer
Explain your choices.
i) I prefer ternary tree. Hash table is a data structure that is suitable for storing the words in a dictionary .But it doesn't support prefix searching.Prefix search is a letter or set of letters where a user types and your dictionary shows all words starting with that prefix. but hash table doesn't support prefix searching.
In this scenario, Ternary is used.Ternary is a data structure which facilitates the efficient retrieval of data.And it supports storing(insertion),prefix search, alphabetical order printing and nearest neighbour search etc. Time complexity of search operation in ternary tree is O(h) where h is height of the tree.
ii) Mainly, Trees are used for storing folders in a computer. I prefer B tree for storing the set of folders in the computer.And it also facilitates quick random access to an block in a particular file.Because you can store both keys and data in the internal and leaf nodes .So we can store set of folders and files.