Haskell trie functions - Inserting values and searching?

Unless you are looking for help with homework, there are many different implementations of tries on hackage.

Unless you are looking for help with homework, there are many different implementations of tries on hackage: hackage.haskell.org/packages/archive/pkg... (search for 'trie' there) Tries take a lot of code to implement, so don't expect people here to provide full implementations - we can only give some clues. So we need to know which problems you face, so we can help you to move forward. A general tip is to start top-to-bottom development using where, deconstruction of arguments and putting undefined instead of yet undeveloped parts: Step 1: trieInsert (keyH : keyT) value (TrieNode oldValue oldChars) = undefined Step 2: Then think about some simplest 'base' cases: trieInsert value (TrieNode _ oldChildren) = TrieNode (Just value) oldChildren trieInsert (keyH : keyT) value (TrieNode oldValue oldChars) = undefined In this example, the first line reads 'if we add an empty key, then the value must be replaced at the root, and child nodes must be left as they are'.

The second line reads: 'if we add a non-empty key, then ...' Step 3: trieInsert value (TrieNode _ oldChildren) = TrieNode (Just value) oldChildren trieInsert (keyH : keyT) value (TrieNode oldValue oldChars) = TrieNode oldValue newChildren where newChildren = undefined The second line now reads: 'if we add a non-empty key, then we leave oldValue as is and modify children somehow'. Then in step 4 elaborate newChildren somehow et cetera.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions