Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add comments in names
  • Loading branch information
doc-jones committed Nov 15, 2019
commit 83a7ab58e9b2b696eb7bf3ccfefc311bbc89c4d3
10 changes: 5 additions & 5 deletions names/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
# if name_1 == name_2:
# duplicates.append(name_1)

bst = BinarySearchTree(names_1[0])
bst = BinarySearchTree(names_1[0])

for name in names_1[1:]:
bst.insert(name)
for name in names_1[1:]: # iterate through names_1 from begining to end
bst.insert(name) # add to BST
duplicates = []
for name in names_2:
if bst.contains(name):
duplicates.append(name)
if bst.contains(name): # compare name in names_2 with bst of names_1
duplicates.append(name) # add name found in both to duplicates[]


end_time = time.time()
Expand Down