{"action":"created","comment":{"url":"https://api.github.com/repos/faheel/Algos/pulls/comments/101516835","pull_request_review_id":22245844,"id":101516835,"diff_hunk":"@@ -0,0 +1,61 @@\n+#include <iostream>\r\n+#include <vector>\r\n+\r\n+#include \"SortingUtils.h\"\r\n+\r\n+using namespace std;\r\n+\r\n+//creates ordered heap\r\n+void heapify(vector<int> &heap,int parent,int size, int order, bool showState){\r\n+  int child = (parent*2)+1, temp;\r\n+  while(child<size){//travels down children\r\n+      displayState(heap);\r\n+    if((order*heap[child])<(order*heap[child+1])&&(child+1<size)){\r\n+      child++;//child refers to the larger/smaller of the two children\r\n+    }\r\n+    else{}\r\n+    if((order*heap[parent])<(order*heap[child])){\r\n+      swap(heap[parent],heap[child]);//if the parent is smaller(order==ascending) or larger(order==descending), then swap\r\n+    }\r\n+    parent = child;\r\n+    child=(parent*2)+1;\r\n+    displayState(heap);\r\n+  }\r\n+}\r\n+//removes largest/smallest node, replaces it and reheapifies with new heap.\r\n+void heapsort(vector<int> &heap,int size, int order,bool showState){\r\n+  int temp,n = size;\r\n+  while(n>0){\r\n+    swap(heap[0], heap[n-1]);\r\n+    n-=1;\r\n+    heapify(heap,0,n, order, showState);\r\n+  }\r\n+}\n+//creates original ordered heap so that heapsort can be run\n+void make_heap(vector<int> &heap, int size, int order, bool showState){\r\n+    for(int x = (size/2)-1; x>=0;x--){ //Searches and reheaps all non-leaf node\r","path":"Sorting/HeapSort.cpp","position":36,"original_position":36,"commit_id":"9c8121d008660585a2156be3cb0909b0ce009911","original_commit_id":"9c8121d008660585a2156be3cb0909b0ce009911","user":{"login":"faheel","id":11466676,"avatar_url":"https://avatars.githubusercontent.com/u/11466676?v=3","gravatar_id":"","url":"https://api.github.com/users/faheel","html_url":"https://github.com/faheel","followers_url":"https://api.github.com/users/faheel/followers","following_url":"https://api.github.com/users/faheel/following{/other_user}","gists_url":"https://api.github.com/users/faheel/gists{/gist_id}","starred_url":"https://api.github.com/users/faheel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faheel/subscriptions","organizations_url":"https://api.github.com/users/faheel/orgs","repos_url":"https://api.github.com/users/faheel/repos","events_url":"https://api.github.com/users/faheel/events{/privacy}","received_events_url":"https://api.github.com/users/faheel/received_events","type":"User","site_admin":false},"body":"Use a more meaningful name for `x`, and/or describe its purpose in the comments.","created_at":"2017-02-16T13:26:37Z","updated_at":"2017-02-16T13:27:02Z","html_url":"https://github.com/faheel/Algos/pull/20#discussion_r101516835","pull_request_url":"https://api.github.com/repos/faheel/Algos/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/faheel/Algos/pulls/comments/101516835"},"html":{"href":"https://github.com/faheel/Algos/pull/20#discussion_r101516835"},"pull_request":{"href":"https://api.github.com/repos/faheel/Algos/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/faheel/Algos/pulls/20","id":106369522,"html_url":"https://github.com/faheel/Algos/pull/20","diff_url":"https://github.com/faheel/Algos/pull/20.diff","patch_url":"https://github.com/faheel/Algos/pull/20.patch","issue_url":"https://api.github.com/repos/faheel/Algos/issues/20","number":20,"state":"open","locked":false,"title":"Added HeapSort Algorithms","user":{"login":"Satch97","id":15304104,"avatar_url":"https://avatars.githubusercontent.com/u/15304104?v=3","gravatar_id":"","url":"https://api.github.com/users/Satch97","html_url":"https://github.com/Satch97","followers_url":"https://api.github.com/users/Satch97/followers","following_url":"https://api.github.com/users/Satch97/following{/other_user}","gists_url":"https://api.github.com/users/Satch97/gists{/gist_id}","starred_url":"https://api.github.com/users/Satch97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Satch97/subscriptions","organizations_url":"https://api.github.com/users/Satch97/orgs","repos_url":"https://api.github.com/users/Satch97/repos","events_url":"https://api.github.com/users/Satch97/events{/privacy}","received_events_url":"https://api.github.com/users/Satch97/received_events","type":"User","site_admin":false},"body":"This takes a heap, implemented using an array(vector in this case) to take advantage of the fact that the index numbers correlate from parent to child by index to index/2.\r\n\r\nAny suggestions are welcome. ","created_at":"2017-02-15T18:22:24Z","updated_at":"2017-02-16T13:27:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f85929c825b695ad3c90e96f5f51072088a15371","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/faheel/Algos/pulls/20/commits","review_comments_url":"https://api.github.com/repos/faheel/Algos/pulls/20/comments","review_comment_url":"https://api.github.com/repos/faheel/Algos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/faheel/Algos/issues/20/comments","statuses_url":"https://api.github.com/repos/faheel/Algos/statuses/9c8121d008660585a2156be3cb0909b0ce009911","head":{"label":"Satch97:master","ref":"master","sha":"9c8121d008660585a2156be3cb0909b0ce009911","user":{"login":"Satch97","id":15304104,"avatar_url":"https://avatars.githubusercontent.com/u/15304104?v=3","gravatar_id":"","url":"https://api.github.com/users/Satch97","html_url":"https://github.com/Satch97","followers_url":"https://api.github.com/users/Satch97/followers","following_url":"https://api.github.com/users/Satch97/following{/other_user}","gists_url":"https://api.github.com/users/Satch97/gists{/gist_id}","starred_url":"https://api.github.com/users/Satch97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Satch97/subscriptions","organizations_url":"https://api.github.com/users/Satch97/orgs","repos_url":"https://api.github.com/users/Satch97/repos","events_url":"https://api.github.com/users/Satch97/events{/privacy}","received_events_url":"https://api.github.com/users/Satch97/received_events","type":"User","site_admin":false},"repo":{"id":81347850,"name":"Algos","full_name":"Satch97/Algos","owner":{"login":"Satch97","id":15304104,"avatar_url":"https://avatars.githubusercontent.com/u/15304104?v=3","gravatar_id":"","url":"https://api.github.com/users/Satch97","html_url":"https://github.com/Satch97","followers_url":"https://api.github.com/users/Satch97/followers","following_url":"https://api.github.com/users/Satch97/following{/other_user}","gists_url":"https://api.github.com/users/Satch97/gists{/gist_id}","starred_url":"https://api.github.com/users/Satch97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Satch97/subscriptions","organizations_url":"https://api.github.com/users/Satch97/orgs","repos_url":"https://api.github.com/users/Satch97/repos","events_url":"https://api.github.com/users/Satch97/events{/privacy}","received_events_url":"https://api.github.com/users/Satch97/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Satch97/Algos","description":"Implementation of well-known (and some rare) algorithms, mostly in C++","fork":true,"url":"https://api.github.com/repos/Satch97/Algos","forks_url":"https://api.github.com/repos/Satch97/Algos/forks","keys_url":"https://api.github.com/repos/Satch97/Algos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Satch97/Algos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Satch97/Algos/teams","hooks_url":"https://api.github.com/repos/Satch97/Algos/hooks","issue_events_url":"https://api.github.com/repos/Satch97/Algos/issues/events{/number}","events_url":"https://api.github.com/repos/Satch97/Algos/events","assignees_url":"https://api.github.com/repos/Satch97/Algos/assignees{/user}","branches_url":"https://api.github.com/repos/Satch97/Algos/branches{/branch}","tags_url":"https://api.github.com/repos/Satch97/Algos/tags","blobs_url":"https://api.github.com/repos/Satch97/Algos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Satch97/Algos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Satch97/Algos/git/refs{/sha}","trees_url":"https://api.github.com/repos/Satch97/Algos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Satch97/Algos/statuses/{sha}","languages_url":"https://api.github.com/repos/Satch97/Algos/languages","stargazers_url":"https://api.github.com/repos/Satch97/Algos/stargazers","contributors_url":"https://api.github.com/repos/Satch97/Algos/contributors","subscribers_url":"https://api.github.com/repos/Satch97/Algos/subscribers","subscription_url":"https://api.github.com/repos/Satch97/Algos/subscription","commits_url":"https://api.github.com/repos/Satch97/Algos/commits{/sha}","git_commits_url":"https://api.github.com/repos/Satch97/Algos/git/commits{/sha}","comments_url":"https://api.github.com/repos/Satch97/Algos/comments{/number}","issue_comment_url":"https://api.github.com/repos/Satch97/Algos/issues/comments{/number}","contents_url":"https://api.github.com/repos/Satch97/Algos/contents/{+path}","compare_url":"https://api.github.com/repos/Satch97/Algos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Satch97/Algos/merges","archive_url":"https://api.github.com/repos/Satch97/Algos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Satch97/Algos/downloads","issues_url":"https://api.github.com/repos/Satch97/Algos/issues{/number}","pulls_url":"https://api.github.com/repos/Satch97/Algos/pulls{/number}","milestones_url":"https://api.github.com/repos/Satch97/Algos/milestones{/number}","notifications_url":"https://api.github.com/repos/Satch97/Algos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Satch97/Algos/labels{/name}","releases_url":"https://api.github.com/repos/Satch97/Algos/releases{/id}","deployments_url":"https://api.github.com/repos/Satch97/Algos/deployments","created_at":"2017-02-08T16:05:22Z","updated_at":"2017-02-09T01:30:43Z","pushed_at":"2017-02-15T18:10:43Z","git_url":"git://github.com/Satch97/Algos.git","ssh_url":"git@github.com:Satch97/Algos.git","clone_url":"https://github.com/Satch97/Algos.git","svn_url":"https://github.com/Satch97/Algos","homepage":null,"size":36,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"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":"faheel:master","ref":"master","sha":"daecba1a04afdff044ea4915f0b945e1295fe1ef","user":{"login":"faheel","id":11466676,"avatar_url":"https://avatars.githubusercontent.com/u/11466676?v=3","gravatar_id":"","url":"https://api.github.com/users/faheel","html_url":"https://github.com/faheel","followers_url":"https://api.github.com/users/faheel/followers","following_url":"https://api.github.com/users/faheel/following{/other_user}","gists_url":"https://api.github.com/users/faheel/gists{/gist_id}","starred_url":"https://api.github.com/users/faheel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faheel/subscriptions","organizations_url":"https://api.github.com/users/faheel/orgs","repos_url":"https://api.github.com/users/faheel/repos","events_url":"https://api.github.com/users/faheel/events{/privacy}","received_events_url":"https://api.github.com/users/faheel/received_events","type":"User","site_admin":false},"repo":{"id":76900154,"name":"Algos","full_name":"faheel/Algos","owner":{"login":"faheel","id":11466676,"avatar_url":"https://avatars.githubusercontent.com/u/11466676?v=3","gravatar_id":"","url":"https://api.github.com/users/faheel","html_url":"https://github.com/faheel","followers_url":"https://api.github.com/users/faheel/followers","following_url":"https://api.github.com/users/faheel/following{/other_user}","gists_url":"https://api.github.com/users/faheel/gists{/gist_id}","starred_url":"https://api.github.com/users/faheel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faheel/subscriptions","organizations_url":"https://api.github.com/users/faheel/orgs","repos_url":"https://api.github.com/users/faheel/repos","events_url":"https://api.github.com/users/faheel/events{/privacy}","received_events_url":"https://api.github.com/users/faheel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/faheel/Algos","description":"Implementation of well-known (and some rare) algorithms, mostly in C++","fork":false,"url":"https://api.github.com/repos/faheel/Algos","forks_url":"https://api.github.com/repos/faheel/Algos/forks","keys_url":"https://api.github.com/repos/faheel/Algos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/faheel/Algos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/faheel/Algos/teams","hooks_url":"https://api.github.com/repos/faheel/Algos/hooks","issue_events_url":"https://api.github.com/repos/faheel/Algos/issues/events{/number}","events_url":"https://api.github.com/repos/faheel/Algos/events","assignees_url":"https://api.github.com/repos/faheel/Algos/assignees{/user}","branches_url":"https://api.github.com/repos/faheel/Algos/branches{/branch}","tags_url":"https://api.github.com/repos/faheel/Algos/tags","blobs_url":"https://api.github.com/repos/faheel/Algos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/faheel/Algos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/faheel/Algos/git/refs{/sha}","trees_url":"https://api.github.com/repos/faheel/Algos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/faheel/Algos/statuses/{sha}","languages_url":"https://api.github.com/repos/faheel/Algos/languages","stargazers_url":"https://api.github.com/repos/faheel/Algos/stargazers","contributors_url":"https://api.github.com/repos/faheel/Algos/contributors","subscribers_url":"https://api.github.com/repos/faheel/Algos/subscribers","subscription_url":"https://api.github.com/repos/faheel/Algos/subscription","commits_url":"https://api.github.com/repos/faheel/Algos/commits{/sha}","git_commits_url":"https://api.github.com/repos/faheel/Algos/git/commits{/sha}","comments_url":"https://api.github.com/repos/faheel/Algos/comments{/number}","issue_comment_url":"https://api.github.com/repos/faheel/Algos/issues/comments{/number}","contents_url":"https://api.github.com/repos/faheel/Algos/contents/{+path}","compare_url":"https://api.github.com/repos/faheel/Algos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/faheel/Algos/merges","archive_url":"https://api.github.com/repos/faheel/Algos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/faheel/Algos/downloads","issues_url":"https://api.github.com/repos/faheel/Algos/issues{/number}","pulls_url":"https://api.github.com/repos/faheel/Algos/pulls{/number}","milestones_url":"https://api.github.com/repos/faheel/Algos/milestones{/number}","notifications_url":"https://api.github.com/repos/faheel/Algos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/faheel/Algos/labels{/name}","releases_url":"https://api.github.com/repos/faheel/Algos/releases{/id}","deployments_url":"https://api.github.com/repos/faheel/Algos/deployments","created_at":"2016-12-19T21:51:27Z","updated_at":"2017-02-14T21:28:04Z","pushed_at":"2017-02-15T18:22:25Z","git_url":"git://github.com/faheel/Algos.git","ssh_url":"git@github.com:faheel/Algos.git","clone_url":"https://github.com/faheel/Algos.git","svn_url":"https://github.com/faheel/Algos","homepage":null,"size":34,"stargazers_count":10,"watchers_count":10,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":14,"forks":13,"open_issues":14,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/faheel/Algos/pulls/20"},"html":{"href":"https://github.com/faheel/Algos/pull/20"},"issue":{"href":"https://api.github.com/repos/faheel/Algos/issues/20"},"comments":{"href":"https://api.github.com/repos/faheel/Algos/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/faheel/Algos/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/faheel/Algos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/faheel/Algos/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/faheel/Algos/statuses/9c8121d008660585a2156be3cb0909b0ce009911"}}}}
{"actor":{"display_login":"faheel"}}