{"action":"created","comment":{"url":"https://api.github.com/repos/henrykh/data-structures/pulls/comments/24713038","id":24713038,"diff_hunk":"@@ -0,0 +1,119 @@\n+# -*- coding: utf-8 -*-\n+\n+\n+class PriorityQueue(object):","path":"priority_queue.py","position":4,"original_position":4,"commit_id":"f3cd4b045b23ae92d3930a53a8902bc29308115a","original_commit_id":"f3cd4b045b23ae92d3930a53a8902bc29308115a","user":{"login":"cewing","id":417109,"avatar_url":"https://avatars.githubusercontent.com/u/417109?v=3","gravatar_id":"","url":"https://api.github.com/users/cewing","html_url":"https://github.com/cewing","followers_url":"https://api.github.com/users/cewing/followers","following_url":"https://api.github.com/users/cewing/following{/other_user}","gists_url":"https://api.github.com/users/cewing/gists{/gist_id}","starred_url":"https://api.github.com/users/cewing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cewing/subscriptions","organizations_url":"https://api.github.com/users/cewing/orgs","repos_url":"https://api.github.com/users/cewing/repos","events_url":"https://api.github.com/users/cewing/events{/privacy}","received_events_url":"https://api.github.com/users/cewing/received_events","type":"User","site_admin":false},"body":"You've gotten the right idea that the binary heap is the basis for the priority queue, but you've completely re-written the heap code instead of composing a heap into this structure.  Consider this:\r\n\r\n```python\r\nfrom binary_heap import BinaryHeap\r\n\r\nclass PriorityQueue(object):\r\n\r\n    def __init__(self):\r\n        self.heap = BinaryHeap()\r\n```\r\n\r\nWhat happens to the rest of your code if you start that way?  What prevents you from doing so?  Does what you see as a stumbling block really block you?  Or is there a way around it?","created_at":"2015-02-14T07:36:06Z","updated_at":"2015-02-14T07:36:06Z","html_url":"https://github.com/henrykh/data-structures/pull/9#discussion_r24713038","pull_request_url":"https://api.github.com/repos/henrykh/data-structures/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/henrykh/data-structures/pulls/comments/24713038"},"html":{"href":"https://github.com/henrykh/data-structures/pull/9#discussion_r24713038"},"pull_request":{"href":"https://api.github.com/repos/henrykh/data-structures/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/henrykh/data-structures/pulls/9","id":29232201,"html_url":"https://github.com/henrykh/data-structures/pull/9","diff_url":"https://github.com/henrykh/data-structures/pull/9.diff","patch_url":"https://github.com/henrykh/data-structures/pull/9.patch","issue_url":"https://api.github.com/repos/henrykh/data-structures/issues/9","number":9,"state":"open","locked":false,"title":"Priority Queue","user":{"login":"henrykh","id":8690446,"avatar_url":"https://avatars.githubusercontent.com/u/8690446?v=3","gravatar_id":"","url":"https://api.github.com/users/henrykh","html_url":"https://github.com/henrykh","followers_url":"https://api.github.com/users/henrykh/followers","following_url":"https://api.github.com/users/henrykh/following{/other_user}","gists_url":"https://api.github.com/users/henrykh/gists{/gist_id}","starred_url":"https://api.github.com/users/henrykh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrykh/subscriptions","organizations_url":"https://api.github.com/users/henrykh/orgs","repos_url":"https://api.github.com/users/henrykh/repos","events_url":"https://api.github.com/users/henrykh/events{/privacy}","received_events_url":"https://api.github.com/users/henrykh/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-13T01:05:01Z","updated_at":"2015-02-14T07:36:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1a272c7e0b55e5338319d225090f53de2aecd6b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/henrykh/data-structures/pulls/9/commits","review_comments_url":"https://api.github.com/repos/henrykh/data-structures/pulls/9/comments","review_comment_url":"https://api.github.com/repos/henrykh/data-structures/pulls/comments/{number}","comments_url":"https://api.github.com/repos/henrykh/data-structures/issues/9/comments","statuses_url":"https://api.github.com/repos/henrykh/data-structures/statuses/f3cd4b045b23ae92d3930a53a8902bc29308115a","head":{"label":"henrykh:priorityq","ref":"priorityq","sha":"f3cd4b045b23ae92d3930a53a8902bc29308115a","user":{"login":"henrykh","id":8690446,"avatar_url":"https://avatars.githubusercontent.com/u/8690446?v=3","gravatar_id":"","url":"https://api.github.com/users/henrykh","html_url":"https://github.com/henrykh","followers_url":"https://api.github.com/users/henrykh/followers","following_url":"https://api.github.com/users/henrykh/following{/other_user}","gists_url":"https://api.github.com/users/henrykh/gists{/gist_id}","starred_url":"https://api.github.com/users/henrykh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrykh/subscriptions","organizations_url":"https://api.github.com/users/henrykh/orgs","repos_url":"https://api.github.com/users/henrykh/repos","events_url":"https://api.github.com/users/henrykh/events{/privacy}","received_events_url":"https://api.github.com/users/henrykh/received_events","type":"User","site_admin":false},"repo":{"id":30315159,"name":"data-structures","full_name":"henrykh/data-structures","owner":{"login":"henrykh","id":8690446,"avatar_url":"https://avatars.githubusercontent.com/u/8690446?v=3","gravatar_id":"","url":"https://api.github.com/users/henrykh","html_url":"https://github.com/henrykh","followers_url":"https://api.github.com/users/henrykh/followers","following_url":"https://api.github.com/users/henrykh/following{/other_user}","gists_url":"https://api.github.com/users/henrykh/gists{/gist_id}","starred_url":"https://api.github.com/users/henrykh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrykh/subscriptions","organizations_url":"https://api.github.com/users/henrykh/orgs","repos_url":"https://api.github.com/users/henrykh/repos","events_url":"https://api.github.com/users/henrykh/events{/privacy}","received_events_url":"https://api.github.com/users/henrykh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henrykh/data-structures","description":"","fork":false,"url":"https://api.github.com/repos/henrykh/data-structures","forks_url":"https://api.github.com/repos/henrykh/data-structures/forks","keys_url":"https://api.github.com/repos/henrykh/data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henrykh/data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henrykh/data-structures/teams","hooks_url":"https://api.github.com/repos/henrykh/data-structures/hooks","issue_events_url":"https://api.github.com/repos/henrykh/data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/henrykh/data-structures/events","assignees_url":"https://api.github.com/repos/henrykh/data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/henrykh/data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/henrykh/data-structures/tags","blobs_url":"https://api.github.com/repos/henrykh/data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henrykh/data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henrykh/data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/henrykh/data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henrykh/data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/henrykh/data-structures/languages","stargazers_url":"https://api.github.com/repos/henrykh/data-structures/stargazers","contributors_url":"https://api.github.com/repos/henrykh/data-structures/contributors","subscribers_url":"https://api.github.com/repos/henrykh/data-structures/subscribers","subscription_url":"https://api.github.com/repos/henrykh/data-structures/subscription","commits_url":"https://api.github.com/repos/henrykh/data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/henrykh/data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/henrykh/data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/henrykh/data-structures/issues/comments/{number}","contents_url":"https://api.github.com/repos/henrykh/data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/henrykh/data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henrykh/data-structures/merges","archive_url":"https://api.github.com/repos/henrykh/data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henrykh/data-structures/downloads","issues_url":"https://api.github.com/repos/henrykh/data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/henrykh/data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/henrykh/data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/henrykh/data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henrykh/data-structures/labels{/name}","releases_url":"https://api.github.com/repos/henrykh/data-structures/releases{/id}","created_at":"2015-02-04T18:52:27Z","updated_at":"2015-02-13T01:03:34Z","pushed_at":"2015-02-13T01:08:08Z","git_url":"git://github.com/henrykh/data-structures.git","ssh_url":"git@github.com:henrykh/data-structures.git","clone_url":"https://github.com/henrykh/data-structures.git","svn_url":"https://github.com/henrykh/data-structures","homepage":null,"size":375,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"henrykh:master","ref":"master","sha":"26681854032423b6f7cc06c791db117fc06b6280","user":{"login":"henrykh","id":8690446,"avatar_url":"https://avatars.githubusercontent.com/u/8690446?v=3","gravatar_id":"","url":"https://api.github.com/users/henrykh","html_url":"https://github.com/henrykh","followers_url":"https://api.github.com/users/henrykh/followers","following_url":"https://api.github.com/users/henrykh/following{/other_user}","gists_url":"https://api.github.com/users/henrykh/gists{/gist_id}","starred_url":"https://api.github.com/users/henrykh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrykh/subscriptions","organizations_url":"https://api.github.com/users/henrykh/orgs","repos_url":"https://api.github.com/users/henrykh/repos","events_url":"https://api.github.com/users/henrykh/events{/privacy}","received_events_url":"https://api.github.com/users/henrykh/received_events","type":"User","site_admin":false},"repo":{"id":30315159,"name":"data-structures","full_name":"henrykh/data-structures","owner":{"login":"henrykh","id":8690446,"avatar_url":"https://avatars.githubusercontent.com/u/8690446?v=3","gravatar_id":"","url":"https://api.github.com/users/henrykh","html_url":"https://github.com/henrykh","followers_url":"https://api.github.com/users/henrykh/followers","following_url":"https://api.github.com/users/henrykh/following{/other_user}","gists_url":"https://api.github.com/users/henrykh/gists{/gist_id}","starred_url":"https://api.github.com/users/henrykh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrykh/subscriptions","organizations_url":"https://api.github.com/users/henrykh/orgs","repos_url":"https://api.github.com/users/henrykh/repos","events_url":"https://api.github.com/users/henrykh/events{/privacy}","received_events_url":"https://api.github.com/users/henrykh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henrykh/data-structures","description":"","fork":false,"url":"https://api.github.com/repos/henrykh/data-structures","forks_url":"https://api.github.com/repos/henrykh/data-structures/forks","keys_url":"https://api.github.com/repos/henrykh/data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henrykh/data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henrykh/data-structures/teams","hooks_url":"https://api.github.com/repos/henrykh/data-structures/hooks","issue_events_url":"https://api.github.com/repos/henrykh/data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/henrykh/data-structures/events","assignees_url":"https://api.github.com/repos/henrykh/data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/henrykh/data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/henrykh/data-structures/tags","blobs_url":"https://api.github.com/repos/henrykh/data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henrykh/data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henrykh/data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/henrykh/data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henrykh/data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/henrykh/data-structures/languages","stargazers_url":"https://api.github.com/repos/henrykh/data-structures/stargazers","contributors_url":"https://api.github.com/repos/henrykh/data-structures/contributors","subscribers_url":"https://api.github.com/repos/henrykh/data-structures/subscribers","subscription_url":"https://api.github.com/repos/henrykh/data-structures/subscription","commits_url":"https://api.github.com/repos/henrykh/data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/henrykh/data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/henrykh/data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/henrykh/data-structures/issues/comments/{number}","contents_url":"https://api.github.com/repos/henrykh/data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/henrykh/data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henrykh/data-structures/merges","archive_url":"https://api.github.com/repos/henrykh/data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henrykh/data-structures/downloads","issues_url":"https://api.github.com/repos/henrykh/data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/henrykh/data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/henrykh/data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/henrykh/data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henrykh/data-structures/labels{/name}","releases_url":"https://api.github.com/repos/henrykh/data-structures/releases{/id}","created_at":"2015-02-04T18:52:27Z","updated_at":"2015-02-13T01:03:34Z","pushed_at":"2015-02-13T01:08:08Z","git_url":"git://github.com/henrykh/data-structures.git","ssh_url":"git@github.com:henrykh/data-structures.git","clone_url":"https://github.com/henrykh/data-structures.git","svn_url":"https://github.com/henrykh/data-structures","homepage":null,"size":375,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/henrykh/data-structures/pulls/9"},"html":{"href":"https://github.com/henrykh/data-structures/pull/9"},"issue":{"href":"https://api.github.com/repos/henrykh/data-structures/issues/9"},"comments":{"href":"https://api.github.com/repos/henrykh/data-structures/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/henrykh/data-structures/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/henrykh/data-structures/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/henrykh/data-structures/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/henrykh/data-structures/statuses/f3cd4b045b23ae92d3930a53a8902bc29308115a"}}}}