Implimentation of trie in scala