Skip to content
Snippets Groups Projects
Commit 51f8cc34 authored by Ritesh Bansal's avatar Ritesh Bansal
Browse files

update Trie

parent b749a038
No related branches found
No related tags found
No related merge requests found
......@@ -119,7 +119,6 @@ class Trie:
return mat
# This function mainly calls ancestorMatrixRec()
def ancestorMatrix(self):
# Create an empty ancestor array
......@@ -129,22 +128,4 @@ class Trie:
import numpy as np
mat = np.zeros((len(self.matrixElements), len(self.matrixElements)),dtype=int)
# Fill ancestor matrix and find
return self.ancestorMatrixRec(self.root, anc, mat)
def main():
keys = ['/spotlight/impact/2014-11-24-master/naturalists.html', '/']
# Trie object
t = Trie()
# Construct trie
for key in keys:
t.insert(key)
# Search for different keys
print("{} ---- {}".format("/spotlight/impact/2014-11-24-master/naturalists.html", [t.search("/spotlight/impact/2014-11-24-master/naturalists.html")]))
print("{} ---- {}".format("/", [t.search("/")]))
if __name__ == '__main__':
main()
\ No newline at end of file
return self.ancestorMatrixRec(self.root, anc, mat)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment