You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
heapq 모듈의 정렬 규칙을 지정하지 않았던 것이 오답의 원인이다. 파이썬알고인터뷰 책에서의 설명은 Q의 타입을 dict[tuple[Weight, Vertex]]로 주었는데, Weight와 Vertex를 거꾸로 준 이유가 바로 tuple 비교는 첫번째 원소부터 진행하기 때문이라는 것이다!
따라서, 일관적으로 코드를 작성하면서(Q와 dist의 타입 순서) 동시에 Weight를 비교하도록 설정하고 싶다면 별도의 래퍼클래스를 지정해야 한다.
The text was updated successfully, but these errors were encountered:
heapq 모듈의 정렬 규칙을 지정하지 않았던 것이 오답의 원인이다. 파이썬알고인터뷰 책에서의 설명은
Q
의 타입을dict[tuple[Weight, Vertex]]
로 주었는데,Weight
와Vertex
를 거꾸로 준 이유가 바로tuple
비교는 첫번째 원소부터 진행하기 때문이라는 것이다!따라서, 일관적으로 코드를 작성하면서(
Q
와dist
의 타입 순서) 동시에Weight
를 비교하도록 설정하고 싶다면 별도의 래퍼클래스를 지정해야 한다.The text was updated successfully, but these errors were encountered: