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

update Trie

parent b749a038
Branches textCompare
No related tags found
No related merge requests found
...@@ -119,7 +119,6 @@ class Trie: ...@@ -119,7 +119,6 @@ class Trie:
return mat return mat
# This function mainly calls ancestorMatrixRec() # This function mainly calls ancestorMatrixRec()
def ancestorMatrix(self): def ancestorMatrix(self):
# Create an empty ancestor array # Create an empty ancestor array
...@@ -129,22 +128,4 @@ class Trie: ...@@ -129,22 +128,4 @@ class Trie:
import numpy as np import numpy as np
mat = np.zeros((len(self.matrixElements), len(self.matrixElements)),dtype=int) mat = np.zeros((len(self.matrixElements), len(self.matrixElements)),dtype=int)
# Fill ancestor matrix and find # Fill ancestor matrix and find
return self.ancestorMatrixRec(self.root, anc, mat) return self.ancestorMatrixRec(self.root, anc, mat)
\ No newline at end of file
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
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