Skip to content

Commit

Permalink
Update alien-dictionary.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Aug 25, 2015
1 parent 3764938 commit 88592e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Python/alien-dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def alienOrder(self, words):
:rtype: str
"""
# Find ancestors of each node by BFS
result, zero_in_degree_queue, in_degree, out_degree = [], [], {}, {}
result, zero_in_degree_queue, in_degree, out_degree = [], collections.deque(), {}, {}
nodes = sets.Set()
for i in xrange(len(words)):
for c in words[i]:
Expand All @@ -23,7 +23,7 @@ def alienOrder(self, words):
zero_in_degree_queue.append(node)

while zero_in_degree_queue:
precedence = zero_in_degree_queue.pop()
precedence = zero_in_degree_queue.popleft()
result.append(precedence)

if precedence in out_degree:
Expand Down

0 comments on commit 88592e0

Please sign in to comment.