Trie deletion time complexity.

Revision en1, by Francesco4203, 2022-06-07 16:36:52

Hi guys, I've just learned a Trie's delete algorithm, which I believe to have a time complexity of O(n.m), where n is the length of the deleted key and m is the size of the set of characters used, as for every time we process a node, we need to check if it still has some other connections to other nodes or not, which takes O(m) time. However, almost every source says that it works in O(n) time. Can anyone please explain to me? Thank you for reading, have a nice day!

Tags #trie, #delete

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Francesco4203 2022-06-07 16:36:52 550 Initial revision (published)