We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 893fd22 commit c1c68d9Copy full SHA for c1c68d9
06_breadth-first_search/python/01_breadth-first_search.py
@@ -16,8 +16,8 @@ def person_is_seller(name):
16
def search(name):
17
search_queue = deque()
18
search_queue += graph[name]
19
- # This array is how you keep track of which people you've searched before.
20
- searched = []
+ # This is how you keep track of which people you've searched before.
+ searched = set()
21
while search_queue:
22
person = search_queue.popleft()
23
# Only search this person if you haven't already searched them.
@@ -28,7 +28,7 @@ def search(name):
28
else:
29
search_queue += graph[person]
30
# Marks this person as searched
31
- searched.append(person)
+ searched.add(person)
32
return False
33
34
search("you")
0 commit comments