GitHub PullRequestReviewCommentEvent at 2014-11-29 06:26:12
Repository: codebase
Actor: whimsycwd
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ds-sww/codebase/pulls/comments/21048841","id":21048841,"diff_hunk":"@@ -0,0 +1,227 @@\n+#include <iostream>\n+#include <cstdio>\n+#include <cassert>\n+#include <cstdlib>\n+#include <cmath>\n+#include <algorithm>\n+using namespace std;\n+class Node\n+{\n+friend class search_tree;\n+private:\n+\tint data;\n+\tNode *left,*right;\n+};\n+class search_tree\n+{\n+private:\n+\tNode *root;\n+\tint length;\n+\tvoid create(int a[],int l,int r,Node *x)\n+\t{\n+\t\tint i=(l+r)/2;\n+\t\tx->data=a[i];\n+\t\tif (l<i) \n+\t\t{\n+\t\t\tx->left=new Node();\n+\t\t\tcreate(a,l,i-1,x->left);\n+\t\t}\n+\t\telse x->left=NULL;\n+\t\tif (i<r)\n+\t\t{\n+\t\t\tx->right=new Node();\n+\t\t\tcreate(a,i+1,r,x->right);\n+\t\t}\n+\t\telse x->right=NULL;\n+\t}\n+\tint Size(Node *x)\n+\t{\n+\t\tif (x==NULL) return 0;\n+\t\treturn Size(x->left)+Size(x->right)+1;\n+\t}\n+\tvoid Preorder(Node *x)\n+\t{\n+\t\tcout<<x->data<<' ';\n+\t\tif (x->left) Preorder(x->left);\n+\t\tif (x->right) Preorder(x->right);\n+\t}\n+\tvoid Inorder(Node *x)\n+\t{\n+\t\tif (x->left) Inorder(x->left);\n+\t\tcout<<x->data<<' ';\n+\t\tif (x->right) Inorder(x->right);\n+\t}\n+\tvoid Postorder(Node *x)\n+\t{\n+\t\tif (x->left) Postorder(x->left);\n+\t\tif (x->right) Postorder(x->right);\n+\t\tcout<<x->data<<' ';\n+\t}\n+\tvoid Levorder()\n+\t{\n+\t\tNode *a[1000];\n+\t\tint top=1;\n+\t\ta[0]=root;\n+\t\tfor (int i=0;i<length;i++)\n+\t\t{\n+\t\t\tcout<<a[i]->data<<endl;\n+\t\t\tif (a[i]->left) a[top++]=a[i]->left;\n+\t\t\tif (a[i]->right) a[top++]=a[i]->right;\n+\t\t}\n+\t\tdelete []*a;\n+\t}\n+\tvoid Add(Node *x,int key)\n+\t{\n+\t\tif (length==0)\n+\t\t{\n+\t\t\troot=new Node();\n+\t\t\troot->data=key;\n+\t\t\troot->left=NULL;root->right=NULL;\n+\t\t\tlength=1;\n+\t\t}\n+\t\tif (key<=x->data) \n+\t\t\tif (x->left) Add(x->left,key);\n+\t\t\telse \n+\t\t\t{\n+\t\t\t\tNode *p=new Node();\n+\t\t\t\tp->data=key;\n+\t\t\t\tp->left=NULL;p->right=NULL;\n+\t\t\t\tx->left=p;\n+\t\t\t\tlength++;\n+\t\t\t}\n+\t\telse\n+\t\t\tif (x->right) Add(x->right,key);\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tNode *p=new Node();\n+\t\t\t\tp->data=key;\n+\t\t\t\tp->left=NULL;p->right=NULL;\n+\t\t\t\tx->right=p;\n+\t\t\t\tlength++;\n+\t\t\t}\n+\t}\n+\tint Del(Node *x,int key,Node *y,int t)\n+\t{\n+\t\tif (x->data==key)\n+\t\t{\n+\t\t\tif (length==1)\n+\t\t\t{\n+\t\t\t\tdelete root;\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tif (x->right)\n+\t\t\t{\n+\t\t\t\tNode *p=x->right;\n+\t\t\t\tif (p->left) \n+\t\t\t\t{\n+\t\t\t\t\tNode *q=p;\n+\t\t\t\t\twhile (p->left) p=p->left;\n+\t\t\t\t\twhile (q->left->left) q=q->left;\n+\t\t\t\t\tx->data=p->data;\n+\t\t\t\t\tq->left=p->right;\n+\t\t\t\t\tdelete p;\n+\t\t\t\t}\n+\t\t\t\telse\n+\t\t\t\t{\n+\t\t\t\t\tx->data=p->data;\n+\t\t\t\t\tx->right=p->right;\n+\t\t\t\t\tdelete p;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tif (t==1) y->left=x->left;\n+\t\t\t\telse y->right=x->left;\n+\t\t\t\tdelete x;\n+\t\t\t}\n+\t\t\treturn Size(y);\n+\t\t}\n+\t\telse \n+\t\t{\n+\t\t\tif ((x->data>key)&&(x->left)) return Del(x->left,key,x,1);\n+\t\t\telse if ((x->data<key)&&(x->right)) return Del(x->right,key,x,2);\n+\t\t\telse \n+\t\t\t{\n+\t\t\t\tcout<<\"Not found!\"<<endl;\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\t\t}\n+\t}\n+public:\n+\tsearch_tree(int size)\n+\t{\n+\t\tassert(size>=0);\n+\t\tif (size==0) \n+\t\t{\n+\t\t\troot=NULL;\n+\t\t\tlength=0;\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\tint *a=new int[size];\n+\t\t\tfor (int i=0;i<size;i++)\n+\t\t\t\tcin>>a[i];\n+\t\t\tsort(a,a+size);\n+\t\t\troot=new Node();\n+\t\t\tcreate(a,0,size-1,root);\n+\t\t\tdelete []a;\n+\t\t\tlength=Size(root);\n+\t\t}\n+\t}\n+\tbool empty() const\n+\t{\n+\t\treturn length==0;\n+\t}\n+\tint size()\n+\t{\n+\t\treturn length;\n+\t}\n+\tint min()\n+\t{\n+\t\tNode *p=root;\n+\t\twhile (p->left) p=p->left;\n+\t\treturn p->data;\n+\t}\n+\tint max()\n+\t{\n+\t\tNode *p=root;\n+\t\twhile (p->right) p=p->right;\n+\t\treturn p->data;\n+\t}\n+\tint height()\n+\t{\n+\t\treturn (int)(log(length)/log(2));\n+\t}\n+\tvoid preorder()\n+\t{\n+\t\tPreorder(root);\n+\t}\n+\tvoid inorder()\n+\t{\n+\t\tInorder(root);\n+\t}\n+\tvoid postorder()\n+\t{\n+\t\tPostorder(root);\n+\t}\n+\tvoid levorder()\n+\t{\n+\t\tLevorder();\n+\t}\n+\tvoid add(int key)\n+\t{\n+\t\tAdd(root,key);\n+\t}\n+\tvoid del(int key)\n+\t{\n+\t\tif (Del(root,key,NULL,0)) length--;\n+\t}","path":"13307130057/assignment8.5/src/BST.cpp","position":218,"original_position":218,"commit_id":"534e603bf5688cd63b194d9ce12382fb115f1a64","original_commit_id":"534e603bf5688cd63b194d9ce12382fb115f1a64","user":{"login":"whimsycwd","id":4927503,"avatar_url":"https://avatars.githubusercontent.com/u/4927503?v=3","gravatar_id":"","url":"https://api.github.com/users/whimsycwd","html_url":"https://github.com/whimsycwd","followers_url":"https://api.github.com/users/whimsycwd/followers","following_url":"https://api.github.com/users/whimsycwd/following{/other_user}","gists_url":"https://api.github.com/users/whimsycwd/gists{/gist_id}","starred_url":"https://api.github.com/users/whimsycwd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whimsycwd/subscriptions","organizations_url":"https://api.github.com/users/whimsycwd/orgs","repos_url":"https://api.github.com/users/whimsycwd/repos","events_url":"https://api.github.com/users/whimsycwd/events{/privacy}","received_events_url":"https://api.github.com/users/whimsycwd/received_events","type":"User","site_admin":false},"body":"遗漏了析构函数","created_at":"2014-11-29T06:26:12Z","updated_at":"2014-11-29T06:26:12Z","html_url":"https://github.com/ds-sww/codebase/pull/429#discussion_r21048841","pull_request_url":"https://api.github.com/repos/ds-sww/codebase/pulls/429","_links":{"self":{"href":"https://api.github.com/repos/ds-sww/codebase/pulls/comments/21048841"},"html":{"href":"https://github.com/ds-sww/codebase/pull/429#discussion_r21048841"},"pull_request":{"href":"https://api.github.com/repos/ds-sww/codebase/pulls/429"}}},"pull_request":{"url":"https://api.github.com/repos/ds-sww/codebase/pulls/429","id":25129486,"html_url":"https://github.com/ds-sww/codebase/pull/429","diff_url":"https://github.com/ds-sww/codebase/pull/429.diff","patch_url":"https://github.com/ds-sww/codebase/pull/429.patch","issue_url":"https://api.github.com/repos/ds-sww/codebase/issues/429","number":429,"state":"open","locked":false,"title":"13307130057_XiaoZhenchen_Assignment8.5","user":{"login":"foreverXZC","id":8863250,"avatar_url":"https://avatars.githubusercontent.com/u/8863250?v=3","gravatar_id":"","url":"https://api.github.com/users/foreverXZC","html_url":"https://github.com/foreverXZC","followers_url":"https://api.github.com/users/foreverXZC/followers","following_url":"https://api.github.com/users/foreverXZC/following{/other_user}","gists_url":"https://api.github.com/users/foreverXZC/gists{/gist_id}","starred_url":"https://api.github.com/users/foreverXZC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foreverXZC/subscriptions","organizations_url":"https://api.github.com/users/foreverXZC/orgs","repos_url":"https://api.github.com/users/foreverXZC/repos","events_url":"https://api.github.com/users/foreverXZC/events{/privacy}","received_events_url":"https://api.github.com/users/foreverXZC/received_events","type":"User","site_admin":false},"body":"上次布置这项作业的时候还没有学BST，昨天上课刚教过，这两天就稍微写了一下。现完成了Part1和Part2，Part3以后有时间再完善。","created_at":"2014-11-27T04:42:15Z","updated_at":"2014-11-29T06:26:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9b56dc81aad59720d32447075b94a05d1272f9d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ds-sww/codebase/pulls/429/commits","review_comments_url":"https://api.github.com/repos/ds-sww/codebase/pulls/429/comments","review_comment_url":"https://api.github.com/repos/ds-sww/codebase/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ds-sww/codebase/issues/429/comments","statuses_url":"https://api.github.com/repos/ds-sww/codebase/statuses/534e603bf5688cd63b194d9ce12382fb115f1a64","head":{"label":"foreverXZC:master","ref":"master","sha":"534e603bf5688cd63b194d9ce12382fb115f1a64","user":{"login":"foreverXZC","id":8863250,"avatar_url":"https://avatars.githubusercontent.com/u/8863250?v=3","gravatar_id":"","url":"https://api.github.com/users/foreverXZC","html_url":"https://github.com/foreverXZC","followers_url":"https://api.github.com/users/foreverXZC/followers","following_url":"https://api.github.com/users/foreverXZC/following{/other_user}","gists_url":"https://api.github.com/users/foreverXZC/gists{/gist_id}","starred_url":"https://api.github.com/users/foreverXZC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foreverXZC/subscriptions","organizations_url":"https://api.github.com/users/foreverXZC/orgs","repos_url":"https://api.github.com/users/foreverXZC/repos","events_url":"https://api.github.com/users/foreverXZC/events{/privacy}","received_events_url":"https://api.github.com/users/foreverXZC/received_events","type":"User","site_admin":false},"repo":{"id":24334831,"name":"codebase","full_name":"foreverXZC/codebase","owner":{"login":"foreverXZC","id":8863250,"avatar_url":"https://avatars.githubusercontent.com/u/8863250?v=3","gravatar_id":"","url":"https://api.github.com/users/foreverXZC","html_url":"https://github.com/foreverXZC","followers_url":"https://api.github.com/users/foreverXZC/followers","following_url":"https://api.github.com/users/foreverXZC/following{/other_user}","gists_url":"https://api.github.com/users/foreverXZC/gists{/gist_id}","starred_url":"https://api.github.com/users/foreverXZC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foreverXZC/subscriptions","organizations_url":"https://api.github.com/users/foreverXZC/orgs","repos_url":"https://api.github.com/users/foreverXZC/repos","events_url":"https://api.github.com/users/foreverXZC/events{/privacy}","received_events_url":"https://api.github.com/users/foreverXZC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/foreverXZC/codebase","description":"","fork":true,"url":"https://api.github.com/repos/foreverXZC/codebase","forks_url":"https://api.github.com/repos/foreverXZC/codebase/forks","keys_url":"https://api.github.com/repos/foreverXZC/codebase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foreverXZC/codebase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foreverXZC/codebase/teams","hooks_url":"https://api.github.com/repos/foreverXZC/codebase/hooks","issue_events_url":"https://api.github.com/repos/foreverXZC/codebase/issues/events{/number}","events_url":"https://api.github.com/repos/foreverXZC/codebase/events","assignees_url":"https://api.github.com/repos/foreverXZC/codebase/assignees{/user}","branches_url":"https://api.github.com/repos/foreverXZC/codebase/branches{/branch}","tags_url":"https://api.github.com/repos/foreverXZC/codebase/tags","blobs_url":"https://api.github.com/repos/foreverXZC/codebase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foreverXZC/codebase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foreverXZC/codebase/git/refs{/sha}","trees_url":"https://api.github.com/repos/foreverXZC/codebase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foreverXZC/codebase/statuses/{sha}","languages_url":"https://api.github.com/repos/foreverXZC/codebase/languages","stargazers_url":"https://api.github.com/repos/foreverXZC/codebase/stargazers","contributors_url":"https://api.github.com/repos/foreverXZC/codebase/contributors","subscribers_url":"https://api.github.com/repos/foreverXZC/codebase/subscribers","subscription_url":"https://api.github.com/repos/foreverXZC/codebase/subscription","commits_url":"https://api.github.com/repos/foreverXZC/codebase/commits{/sha}","git_commits_url":"https://api.github.com/repos/foreverXZC/codebase/git/commits{/sha}","comments_url":"https://api.github.com/repos/foreverXZC/codebase/comments{/number}","issue_comment_url":"https://api.github.com/repos/foreverXZC/codebase/issues/comments/{number}","contents_url":"https://api.github.com/repos/foreverXZC/codebase/contents/{+path}","compare_url":"https://api.github.com/repos/foreverXZC/codebase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foreverXZC/codebase/merges","archive_url":"https://api.github.com/repos/foreverXZC/codebase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foreverXZC/codebase/downloads","issues_url":"https://api.github.com/repos/foreverXZC/codebase/issues{/number}","pulls_url":"https://api.github.com/repos/foreverXZC/codebase/pulls{/number}","milestones_url":"https://api.github.com/repos/foreverXZC/codebase/milestones{/number}","notifications_url":"https://api.github.com/repos/foreverXZC/codebase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foreverXZC/codebase/labels{/name}","releases_url":"https://api.github.com/repos/foreverXZC/codebase/releases{/id}","created_at":"2014-09-22T15:45:27Z","updated_at":"2014-11-27T04:38:04Z","pushed_at":"2014-11-27T04:38:04Z","git_url":"git://github.com/foreverXZC/codebase.git","ssh_url":"git@github.com:foreverXZC/codebase.git","clone_url":"https://github.com/foreverXZC/codebase.git","svn_url":"https://github.com/foreverXZC/codebase","homepage":null,"size":661,"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":"ds-sww:master","ref":"master","sha":"60dce5c2142c6d8299e04b000b4c17153a11a7f9","user":{"login":"ds-sww","id":8822178,"avatar_url":"https://avatars.githubusercontent.com/u/8822178?v=3","gravatar_id":"","url":"https://api.github.com/users/ds-sww","html_url":"https://github.com/ds-sww","followers_url":"https://api.github.com/users/ds-sww/followers","following_url":"https://api.github.com/users/ds-sww/following{/other_user}","gists_url":"https://api.github.com/users/ds-sww/gists{/gist_id}","starred_url":"https://api.github.com/users/ds-sww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ds-sww/subscriptions","organizations_url":"https://api.github.com/users/ds-sww/orgs","repos_url":"https://api.github.com/users/ds-sww/repos","events_url":"https://api.github.com/users/ds-sww/events{/privacy}","received_events_url":"https://api.github.com/users/ds-sww/received_events","type":"User","site_admin":false},"repo":{"id":24193317,"name":"codebase","full_name":"ds-sww/codebase","owner":{"login":"ds-sww","id":8822178,"avatar_url":"https://avatars.githubusercontent.com/u/8822178?v=3","gravatar_id":"","url":"https://api.github.com/users/ds-sww","html_url":"https://github.com/ds-sww","followers_url":"https://api.github.com/users/ds-sww/followers","following_url":"https://api.github.com/users/ds-sww/following{/other_user}","gists_url":"https://api.github.com/users/ds-sww/gists{/gist_id}","starred_url":"https://api.github.com/users/ds-sww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ds-sww/subscriptions","organizations_url":"https://api.github.com/users/ds-sww/orgs","repos_url":"https://api.github.com/users/ds-sww/repos","events_url":"https://api.github.com/users/ds-sww/events{/privacy}","received_events_url":"https://api.github.com/users/ds-sww/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ds-sww/codebase","description":"","fork":false,"url":"https://api.github.com/repos/ds-sww/codebase","forks_url":"https://api.github.com/repos/ds-sww/codebase/forks","keys_url":"https://api.github.com/repos/ds-sww/codebase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ds-sww/codebase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ds-sww/codebase/teams","hooks_url":"https://api.github.com/repos/ds-sww/codebase/hooks","issue_events_url":"https://api.github.com/repos/ds-sww/codebase/issues/events{/number}","events_url":"https://api.github.com/repos/ds-sww/codebase/events","assignees_url":"https://api.github.com/repos/ds-sww/codebase/assignees{/user}","branches_url":"https://api.github.com/repos/ds-sww/codebase/branches{/branch}","tags_url":"https://api.github.com/repos/ds-sww/codebase/tags","blobs_url":"https://api.github.com/repos/ds-sww/codebase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ds-sww/codebase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ds-sww/codebase/git/refs{/sha}","trees_url":"https://api.github.com/repos/ds-sww/codebase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ds-sww/codebase/statuses/{sha}","languages_url":"https://api.github.com/repos/ds-sww/codebase/languages","stargazers_url":"https://api.github.com/repos/ds-sww/codebase/stargazers","contributors_url":"https://api.github.com/repos/ds-sww/codebase/contributors","subscribers_url":"https://api.github.com/repos/ds-sww/codebase/subscribers","subscription_url":"https://api.github.com/repos/ds-sww/codebase/subscription","commits_url":"https://api.github.com/repos/ds-sww/codebase/commits{/sha}","git_commits_url":"https://api.github.com/repos/ds-sww/codebase/git/commits{/sha}","comments_url":"https://api.github.com/repos/ds-sww/codebase/comments{/number}","issue_comment_url":"https://api.github.com/repos/ds-sww/codebase/issues/comments/{number}","contents_url":"https://api.github.com/repos/ds-sww/codebase/contents/{+path}","compare_url":"https://api.github.com/repos/ds-sww/codebase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ds-sww/codebase/merges","archive_url":"https://api.github.com/repos/ds-sww/codebase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ds-sww/codebase/downloads","issues_url":"https://api.github.com/repos/ds-sww/codebase/issues{/number}","pulls_url":"https://api.github.com/repos/ds-sww/codebase/pulls{/number}","milestones_url":"https://api.github.com/repos/ds-sww/codebase/milestones{/number}","notifications_url":"https://api.github.com/repos/ds-sww/codebase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ds-sww/codebase/labels{/name}","releases_url":"https://api.github.com/repos/ds-sww/codebase/releases{/id}","created_at":"2014-09-18T15:21:02Z","updated_at":"2014-11-28T02:08:28Z","pushed_at":"2014-11-28T02:08:28Z","git_url":"git://github.com/ds-sww/codebase.git","ssh_url":"git@github.com:ds-sww/codebase.git","clone_url":"https://github.com/ds-sww/codebase.git","svn_url":"https://github.com/ds-sww/codebase","homepage":null,"size":8296,"stargazers_count":5,"watchers_count":5,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":3,"forks":47,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ds-sww/codebase/pulls/429"},"html":{"href":"https://github.com/ds-sww/codebase/pull/429"},"issue":{"href":"https://api.github.com/repos/ds-sww/codebase/issues/429"},"comments":{"href":"https://api.github.com/repos/ds-sww/codebase/issues/429/comments"},"review_comments":{"href":"https://api.github.com/repos/ds-sww/codebase/pulls/429/comments"},"review_comment":{"href":"https://api.github.com/repos/ds-sww/codebase/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ds-sww/codebase/pulls/429/commits"},"statuses":{"href":"https://api.github.com/repos/ds-sww/codebase/statuses/534e603bf5688cd63b194d9ce12382fb115f1a64"}}}}