Secret.Codes's blog

By Secret.Codes, history, 7 years ago, In English

i use 2D array for trie.

I want to learn how to declare memory of 2D array.

let i will insert n string , each string's length will be at most m.

Now how to declare 2D array and why??

please explain.

  • Vote: I like it
  • -9
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Inserting a string of length m will create at most m nodes, so T[n*m][26(the size of your alphabet)] will be enough.

»
7 years ago, # |
  Vote: I like it +2 Vote: I do not like it

See this implementation.