{"action":"created","comment":{"url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/comments/60814256","id":60814256,"diff_hunk":"@@ -0,0 +1,50 @@\n+def merge_sort(lst):\n+    \"\"\"Sort list using the mergesort method.\"\"\"\n+    half = len(lst) // 2\n+    left_side = lst[:half]\n+    right_side = lst[half:]\n+\n+    while left_side and right_side:\n+        if left_side:\n+            merge_sort(left_side)\n+        if right_side:\n+            merge_sort(right_side)\n+\n+        i = 0\n+        while left_side and right_side:\n+            if left_side[0] > right_side[0]:\n+                lst[i] = right_side.pop(0)\n+            else:\n+                lst[i] = left_side.pop(0)\n+            i += 1\n+\n+        for side in (left_side, right_side):\n+            while side:\n+                lst[i] = side.pop(0)\n+                i += 1\n+\n+if __name__ == \"__main__\":\n+    import timeit\n+    from random import randint\n+    times = 500\n+\n+    def test1():\n+        merge_sort([2, 1])\n+\n+    def test2():\n+        merge_sort([randint(0, 1000000) for i in range(1000)])\n+\n+    avg_time = timeit.Timer(test1).timeit(times)\n+    avg_time_big = timeit.Timer(test2).timeit(times)\n+\n+    print(\"\"\"Merge sort recursively splits the list in half and creates \n+a new list by comparing items from left to right in each of those lists.\"\"\")\n+    print()\n+\n+    print(\"Input: [2, 1]\")\n+    print(\"\\tnumber of runs: {}\".format(times))\n+    print(\"\\taverage time  : {}\".format(avg_time))\n+    print()\n+    print(\"Input: [randint(0, 1000000) for i in range(1000)]\")\n+    print(\"\\tnumber of runs: {}\".format(times))\n+    print(\"\\taverage time  : {}\".format(avg_time_big))","path":"src/mergesort.py","position":50,"original_position":50,"commit_id":"211cfc40999231b7af7557cd86492da84d69ed58","original_commit_id":"211cfc40999231b7af7557cd86492da84d69ed58","user":{"login":"nhuntwalker","id":5581888,"avatar_url":"https://avatars.githubusercontent.com/u/5581888?v=3","gravatar_id":"","url":"https://api.github.com/users/nhuntwalker","html_url":"https://github.com/nhuntwalker","followers_url":"https://api.github.com/users/nhuntwalker/followers","following_url":"https://api.github.com/users/nhuntwalker/following{/other_user}","gists_url":"https://api.github.com/users/nhuntwalker/gists{/gist_id}","starred_url":"https://api.github.com/users/nhuntwalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhuntwalker/subscriptions","organizations_url":"https://api.github.com/users/nhuntwalker/orgs","repos_url":"https://api.github.com/users/nhuntwalker/repos","events_url":"https://api.github.com/users/nhuntwalker/events{/privacy}","received_events_url":"https://api.github.com/users/nhuntwalker/received_events","type":"User","site_admin":false},"body":"Where are your best-case and worst-case runs? Are these the best/worst cases? Because you should say so if they are.","created_at":"2016-04-22T23:07:16Z","updated_at":"2016-04-22T23:07:16Z","html_url":"https://github.com/SeleniumK/data_structures2/pull/9#discussion_r60814256","pull_request_url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/comments/60814256"},"html":{"href":"https://github.com/SeleniumK/data_structures2/pull/9#discussion_r60814256"},"pull_request":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9","id":67273953,"html_url":"https://github.com/SeleniumK/data_structures2/pull/9","diff_url":"https://github.com/SeleniumK/data_structures2/pull/9.diff","patch_url":"https://github.com/SeleniumK/data_structures2/pull/9.patch","issue_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues/9","number":9,"state":"closed","locked":false,"title":"Mergesort","user":{"login":"SeleniumK","id":14043382,"avatar_url":"https://avatars.githubusercontent.com/u/14043382?v=3","gravatar_id":"","url":"https://api.github.com/users/SeleniumK","html_url":"https://github.com/SeleniumK","followers_url":"https://api.github.com/users/SeleniumK/followers","following_url":"https://api.github.com/users/SeleniumK/following{/other_user}","gists_url":"https://api.github.com/users/SeleniumK/gists{/gist_id}","starred_url":"https://api.github.com/users/SeleniumK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeleniumK/subscriptions","organizations_url":"https://api.github.com/users/SeleniumK/orgs","repos_url":"https://api.github.com/users/SeleniumK/repos","events_url":"https://api.github.com/users/SeleniumK/events{/privacy}","received_events_url":"https://api.github.com/users/SeleniumK/received_events","type":"User","site_admin":false},"body":"Both Mergesort and quicksort","created_at":"2016-04-20T23:18:08Z","updated_at":"2016-04-22T23:07:16Z","closed_at":"2016-04-20T23:28:51Z","merged_at":"2016-04-20T23:28:51Z","merge_commit_sha":"f59d2426f689854829e98c493a831ef672c8ef07","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9/commits","review_comments_url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9/comments","review_comment_url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues/9/comments","statuses_url":"https://api.github.com/repos/SeleniumK/data_structures2/statuses/211cfc40999231b7af7557cd86492da84d69ed58","head":{"label":"SeleniumK:mergesort","ref":"mergesort","sha":"211cfc40999231b7af7557cd86492da84d69ed58","user":{"login":"SeleniumK","id":14043382,"avatar_url":"https://avatars.githubusercontent.com/u/14043382?v=3","gravatar_id":"","url":"https://api.github.com/users/SeleniumK","html_url":"https://github.com/SeleniumK","followers_url":"https://api.github.com/users/SeleniumK/followers","following_url":"https://api.github.com/users/SeleniumK/following{/other_user}","gists_url":"https://api.github.com/users/SeleniumK/gists{/gist_id}","starred_url":"https://api.github.com/users/SeleniumK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeleniumK/subscriptions","organizations_url":"https://api.github.com/users/SeleniumK/orgs","repos_url":"https://api.github.com/users/SeleniumK/repos","events_url":"https://api.github.com/users/SeleniumK/events{/privacy}","received_events_url":"https://api.github.com/users/SeleniumK/received_events","type":"User","site_admin":false},"repo":{"id":55638134,"name":"data_structures2","full_name":"SeleniumK/data_structures2","owner":{"login":"SeleniumK","id":14043382,"avatar_url":"https://avatars.githubusercontent.com/u/14043382?v=3","gravatar_id":"","url":"https://api.github.com/users/SeleniumK","html_url":"https://github.com/SeleniumK","followers_url":"https://api.github.com/users/SeleniumK/followers","following_url":"https://api.github.com/users/SeleniumK/following{/other_user}","gists_url":"https://api.github.com/users/SeleniumK/gists{/gist_id}","starred_url":"https://api.github.com/users/SeleniumK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeleniumK/subscriptions","organizations_url":"https://api.github.com/users/SeleniumK/orgs","repos_url":"https://api.github.com/users/SeleniumK/repos","events_url":"https://api.github.com/users/SeleniumK/events{/privacy}","received_events_url":"https://api.github.com/users/SeleniumK/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SeleniumK/data_structures2","description":"Second series of classical data structures","fork":false,"url":"https://api.github.com/repos/SeleniumK/data_structures2","forks_url":"https://api.github.com/repos/SeleniumK/data_structures2/forks","keys_url":"https://api.github.com/repos/SeleniumK/data_structures2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SeleniumK/data_structures2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SeleniumK/data_structures2/teams","hooks_url":"https://api.github.com/repos/SeleniumK/data_structures2/hooks","issue_events_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues/events{/number}","events_url":"https://api.github.com/repos/SeleniumK/data_structures2/events","assignees_url":"https://api.github.com/repos/SeleniumK/data_structures2/assignees{/user}","branches_url":"https://api.github.com/repos/SeleniumK/data_structures2/branches{/branch}","tags_url":"https://api.github.com/repos/SeleniumK/data_structures2/tags","blobs_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/refs{/sha}","trees_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SeleniumK/data_structures2/statuses/{sha}","languages_url":"https://api.github.com/repos/SeleniumK/data_structures2/languages","stargazers_url":"https://api.github.com/repos/SeleniumK/data_structures2/stargazers","contributors_url":"https://api.github.com/repos/SeleniumK/data_structures2/contributors","subscribers_url":"https://api.github.com/repos/SeleniumK/data_structures2/subscribers","subscription_url":"https://api.github.com/repos/SeleniumK/data_structures2/subscription","commits_url":"https://api.github.com/repos/SeleniumK/data_structures2/commits{/sha}","git_commits_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/commits{/sha}","comments_url":"https://api.github.com/repos/SeleniumK/data_structures2/comments{/number}","issue_comment_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues/comments{/number}","contents_url":"https://api.github.com/repos/SeleniumK/data_structures2/contents/{+path}","compare_url":"https://api.github.com/repos/SeleniumK/data_structures2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SeleniumK/data_structures2/merges","archive_url":"https://api.github.com/repos/SeleniumK/data_structures2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SeleniumK/data_structures2/downloads","issues_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues{/number}","pulls_url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls{/number}","milestones_url":"https://api.github.com/repos/SeleniumK/data_structures2/milestones{/number}","notifications_url":"https://api.github.com/repos/SeleniumK/data_structures2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SeleniumK/data_structures2/labels{/name}","releases_url":"https://api.github.com/repos/SeleniumK/data_structures2/releases{/id}","deployments_url":"https://api.github.com/repos/SeleniumK/data_structures2/deployments","created_at":"2016-04-06T20:25:41Z","updated_at":"2016-04-07T00:04:19Z","pushed_at":"2016-04-22T15:31:11Z","git_url":"git://github.com/SeleniumK/data_structures2.git","ssh_url":"git@github.com:SeleniumK/data_structures2.git","clone_url":"https://github.com/SeleniumK/data_structures2.git","svn_url":"https://github.com/SeleniumK/data_structures2","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"SeleniumK:master","ref":"master","sha":"048fdc871005572d72ea4f1e1604799b440defd9","user":{"login":"SeleniumK","id":14043382,"avatar_url":"https://avatars.githubusercontent.com/u/14043382?v=3","gravatar_id":"","url":"https://api.github.com/users/SeleniumK","html_url":"https://github.com/SeleniumK","followers_url":"https://api.github.com/users/SeleniumK/followers","following_url":"https://api.github.com/users/SeleniumK/following{/other_user}","gists_url":"https://api.github.com/users/SeleniumK/gists{/gist_id}","starred_url":"https://api.github.com/users/SeleniumK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeleniumK/subscriptions","organizations_url":"https://api.github.com/users/SeleniumK/orgs","repos_url":"https://api.github.com/users/SeleniumK/repos","events_url":"https://api.github.com/users/SeleniumK/events{/privacy}","received_events_url":"https://api.github.com/users/SeleniumK/received_events","type":"User","site_admin":false},"repo":{"id":55638134,"name":"data_structures2","full_name":"SeleniumK/data_structures2","owner":{"login":"SeleniumK","id":14043382,"avatar_url":"https://avatars.githubusercontent.com/u/14043382?v=3","gravatar_id":"","url":"https://api.github.com/users/SeleniumK","html_url":"https://github.com/SeleniumK","followers_url":"https://api.github.com/users/SeleniumK/followers","following_url":"https://api.github.com/users/SeleniumK/following{/other_user}","gists_url":"https://api.github.com/users/SeleniumK/gists{/gist_id}","starred_url":"https://api.github.com/users/SeleniumK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeleniumK/subscriptions","organizations_url":"https://api.github.com/users/SeleniumK/orgs","repos_url":"https://api.github.com/users/SeleniumK/repos","events_url":"https://api.github.com/users/SeleniumK/events{/privacy}","received_events_url":"https://api.github.com/users/SeleniumK/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SeleniumK/data_structures2","description":"Second series of classical data structures","fork":false,"url":"https://api.github.com/repos/SeleniumK/data_structures2","forks_url":"https://api.github.com/repos/SeleniumK/data_structures2/forks","keys_url":"https://api.github.com/repos/SeleniumK/data_structures2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SeleniumK/data_structures2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SeleniumK/data_structures2/teams","hooks_url":"https://api.github.com/repos/SeleniumK/data_structures2/hooks","issue_events_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues/events{/number}","events_url":"https://api.github.com/repos/SeleniumK/data_structures2/events","assignees_url":"https://api.github.com/repos/SeleniumK/data_structures2/assignees{/user}","branches_url":"https://api.github.com/repos/SeleniumK/data_structures2/branches{/branch}","tags_url":"https://api.github.com/repos/SeleniumK/data_structures2/tags","blobs_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/refs{/sha}","trees_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SeleniumK/data_structures2/statuses/{sha}","languages_url":"https://api.github.com/repos/SeleniumK/data_structures2/languages","stargazers_url":"https://api.github.com/repos/SeleniumK/data_structures2/stargazers","contributors_url":"https://api.github.com/repos/SeleniumK/data_structures2/contributors","subscribers_url":"https://api.github.com/repos/SeleniumK/data_structures2/subscribers","subscription_url":"https://api.github.com/repos/SeleniumK/data_structures2/subscription","commits_url":"https://api.github.com/repos/SeleniumK/data_structures2/commits{/sha}","git_commits_url":"https://api.github.com/repos/SeleniumK/data_structures2/git/commits{/sha}","comments_url":"https://api.github.com/repos/SeleniumK/data_structures2/comments{/number}","issue_comment_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues/comments{/number}","contents_url":"https://api.github.com/repos/SeleniumK/data_structures2/contents/{+path}","compare_url":"https://api.github.com/repos/SeleniumK/data_structures2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SeleniumK/data_structures2/merges","archive_url":"https://api.github.com/repos/SeleniumK/data_structures2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SeleniumK/data_structures2/downloads","issues_url":"https://api.github.com/repos/SeleniumK/data_structures2/issues{/number}","pulls_url":"https://api.github.com/repos/SeleniumK/data_structures2/pulls{/number}","milestones_url":"https://api.github.com/repos/SeleniumK/data_structures2/milestones{/number}","notifications_url":"https://api.github.com/repos/SeleniumK/data_structures2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SeleniumK/data_structures2/labels{/name}","releases_url":"https://api.github.com/repos/SeleniumK/data_structures2/releases{/id}","deployments_url":"https://api.github.com/repos/SeleniumK/data_structures2/deployments","created_at":"2016-04-06T20:25:41Z","updated_at":"2016-04-07T00:04:19Z","pushed_at":"2016-04-22T15:31:11Z","git_url":"git://github.com/SeleniumK/data_structures2.git","ssh_url":"git@github.com:SeleniumK/data_structures2.git","clone_url":"https://github.com/SeleniumK/data_structures2.git","svn_url":"https://github.com/SeleniumK/data_structures2","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9"},"html":{"href":"https://github.com/SeleniumK/data_structures2/pull/9"},"issue":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/issues/9"},"comments":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/SeleniumK/data_structures2/statuses/211cfc40999231b7af7557cd86492da84d69ed58"}}}}