{"action":"created","comment":{"url":"https://api.github.com/repos/igoroogle/sort/pulls/comments/166304560","pull_request_review_id":94347375,"id":166304560,"diff_hunk":"@@ -1,151 +1,151 @@\n-#include<cstdio>\n-#include<iostream>\n-template<typename T> void Swap(T& elem1, T& elem2) {\n-    T other = elem1;\n-    elem1 = elem2;\n-    elem2 = other;\n-}\n+#include <iostream>\n \n-template <typename T> class Point {\n+template <typename T> class Node {\n  public:\n     T val;\n-    Point *next;\n-    Point(T val) {\n+    Node *next;\n+\n+    Node() {\n+        next = NULL;\n+    }\n+\n+    Node(T val) {\n         this->val = val;\n         next = NULL;\n     }\n };\n \n template<typename T> class List {\n- public:\n-    const size_t size() {\n-        return size_val;\n+public:\n+    size_t size() const {\n+        return sizeVal;\n+    }\n+\n+    List(size_t sizeVal, Node<T> *first, Node<T> *last) {\n+        this->sizeVal = sizeVal;\n+        this->first = first;\n+        this->last = last;\n     }\n \n     List() {\n-        size_val = 0;\n-        left = NULL;\n-        right = NULL;\n+        sizeVal = 0;\n+        first = new Node<T>();\n+        last = first;\n     }\n \n     ~List() {\n-        Point<T> *cur = left, *cur1;\n-        while (cur != NULL) {\n-            cur1 = cur;\n-            cur = cur->next;\n-            delete(cur1);\n+        if (first == NULL) {\n+            return;\n         }\n-    }\n \n-    void Add(T& val) {\n-        if (right == NULL) {\n-            right = new Point<T>(val);\n-            left = right;\n-            size_val = 1;\n-        } else {\n-            right->next = new Point<T>(val);\n-            right = right->next;\n-            ++size_val;\n+        Node<T> *nextHead = first, *head;\n+        while (nextHead != last) {\n+            head = nextHead;\n+            nextHead = nextHead->next;\n+            delete head;\n         }\n+        delete(last);\n+    }\n+\n+    void Add(T val) {\n+        last->val = val;\n+        last->next = new Node<T>();\n+        last = last->next;\n+        ++sizeVal;\n+    }\n+\n+    void updFirst(Node<T>* newFirst) {\n+        first = newFirst;\n     }\n \n-    Point<T>* begin() const {\n-        return left;\n+    Node<T>* begin() const {\n+        return first;\n     }\n \n-    Point<T>* end() const {\n-        return right;\n+    Node<T>* end() const {\n+        return last;\n     }\n \n  private:\n-    Point<T> *left, *right;\n-    size_t size_val;\n+    Node<T> *first, *last;\n+    size_t sizeVal;\n };\n \n-template <typename T> std::ostream& operator << (std::ostream& out, const List<T> &ans) {\n-        auto cur = ans.begin();\n-        while (cur != ans.end()) {\n-            out << cur->val << ' ';\n-            cur = cur->next;\n+template <typename T> std::ostream& operator << (std::ostream& out, const List<T> &outVal) {\n+        auto element = outVal.begin();\n+        while (element != outVal.end()) {\n+            out << element->val << ' ';\n+            element = element->next;\n         }\n \n-        out << ans.end()->val;\n         return out;\n }\n \n-template <typename T> void Sort(Point<T> *first, Point<T> *last) {\n-        if (first == last)\n+template <typename T> void Sort(List<T>& sortList) {\n+        if (sortList.size() < 2) {\n             return;\n+        }\n \n-        if (first->next == last) {\n-            if (first->val > last->val) {\n-                Swap(first->val, last->val);\n+        if (sortList.size() == 2) {","path":"main","position":137,"original_position":137,"commit_id":"2d5f74e256597334e596fe46aa90f684cefdd362","original_commit_id":"2d5f74e256597334e596fe46aa90f684cefdd362","user":{"login":"ifsmirnov","id":1241053,"avatar_url":"https://avatars3.githubusercontent.com/u/1241053?v=4","gravatar_id":"","url":"https://api.github.com/users/ifsmirnov","html_url":"https://github.com/ifsmirnov","followers_url":"https://api.github.com/users/ifsmirnov/followers","following_url":"https://api.github.com/users/ifsmirnov/following{/other_user}","gists_url":"https://api.github.com/users/ifsmirnov/gists{/gist_id}","starred_url":"https://api.github.com/users/ifsmirnov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifsmirnov/subscriptions","organizations_url":"https://api.github.com/users/ifsmirnov/orgs","repos_url":"https://api.github.com/users/ifsmirnov/repos","events_url":"https://api.github.com/users/ifsmirnov/events{/privacy}","received_events_url":"https://api.github.com/users/ifsmirnov/received_events","type":"User","site_admin":false},"body":"Зачем отдельно обрабатывать случай с двойкой?","created_at":"2018-02-06T13:51:23Z","updated_at":"2018-02-06T13:52:36Z","html_url":"https://github.com/igoroogle/sort/pull/1#discussion_r166304560","pull_request_url":"https://api.github.com/repos/igoroogle/sort/pulls/1","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/igoroogle/sort/pulls/comments/166304560"},"html":{"href":"https://github.com/igoroogle/sort/pull/1#discussion_r166304560"},"pull_request":{"href":"https://api.github.com/repos/igoroogle/sort/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/igoroogle/sort/pulls/1","id":160068405,"html_url":"https://github.com/igoroogle/sort/pull/1","diff_url":"https://github.com/igoroogle/sort/pull/1.diff","patch_url":"https://github.com/igoroogle/sort/pull/1.patch","issue_url":"https://api.github.com/repos/igoroogle/sort/issues/1","number":1,"state":"open","locked":false,"title":"Add files via upload","user":{"login":"igoroogle","id":16157144,"avatar_url":"https://avatars2.githubusercontent.com/u/16157144?v=4","gravatar_id":"","url":"https://api.github.com/users/igoroogle","html_url":"https://github.com/igoroogle","followers_url":"https://api.github.com/users/igoroogle/followers","following_url":"https://api.github.com/users/igoroogle/following{/other_user}","gists_url":"https://api.github.com/users/igoroogle/gists{/gist_id}","starred_url":"https://api.github.com/users/igoroogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igoroogle/subscriptions","organizations_url":"https://api.github.com/users/igoroogle/orgs","repos_url":"https://api.github.com/users/igoroogle/repos","events_url":"https://api.github.com/users/igoroogle/events{/privacy}","received_events_url":"https://api.github.com/users/igoroogle/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-25T21:04:05Z","updated_at":"2018-02-06T13:52:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06001611b2f87c63eccfb315e2ef0296de786123","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/igoroogle/sort/pulls/1/commits","review_comments_url":"https://api.github.com/repos/igoroogle/sort/pulls/1/comments","review_comment_url":"https://api.github.com/repos/igoroogle/sort/pulls/comments{/number}","comments_url":"https://api.github.com/repos/igoroogle/sort/issues/1/comments","statuses_url":"https://api.github.com/repos/igoroogle/sort/statuses/2d5f74e256597334e596fe46aa90f684cefdd362","head":{"label":"igoroogle:igoroogle-patch-1","ref":"igoroogle-patch-1","sha":"2d5f74e256597334e596fe46aa90f684cefdd362","user":{"login":"igoroogle","id":16157144,"avatar_url":"https://avatars2.githubusercontent.com/u/16157144?v=4","gravatar_id":"","url":"https://api.github.com/users/igoroogle","html_url":"https://github.com/igoroogle","followers_url":"https://api.github.com/users/igoroogle/followers","following_url":"https://api.github.com/users/igoroogle/following{/other_user}","gists_url":"https://api.github.com/users/igoroogle/gists{/gist_id}","starred_url":"https://api.github.com/users/igoroogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igoroogle/subscriptions","organizations_url":"https://api.github.com/users/igoroogle/orgs","repos_url":"https://api.github.com/users/igoroogle/repos","events_url":"https://api.github.com/users/igoroogle/events{/privacy}","received_events_url":"https://api.github.com/users/igoroogle/received_events","type":"User","site_admin":false},"repo":{"id":115362313,"name":"sort","full_name":"igoroogle/sort","owner":{"login":"igoroogle","id":16157144,"avatar_url":"https://avatars2.githubusercontent.com/u/16157144?v=4","gravatar_id":"","url":"https://api.github.com/users/igoroogle","html_url":"https://github.com/igoroogle","followers_url":"https://api.github.com/users/igoroogle/followers","following_url":"https://api.github.com/users/igoroogle/following{/other_user}","gists_url":"https://api.github.com/users/igoroogle/gists{/gist_id}","starred_url":"https://api.github.com/users/igoroogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igoroogle/subscriptions","organizations_url":"https://api.github.com/users/igoroogle/orgs","repos_url":"https://api.github.com/users/igoroogle/repos","events_url":"https://api.github.com/users/igoroogle/events{/privacy}","received_events_url":"https://api.github.com/users/igoroogle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/igoroogle/sort","description":null,"fork":false,"url":"https://api.github.com/repos/igoroogle/sort","forks_url":"https://api.github.com/repos/igoroogle/sort/forks","keys_url":"https://api.github.com/repos/igoroogle/sort/keys{/key_id}","collaborators_url":"https://api.github.com/repos/igoroogle/sort/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/igoroogle/sort/teams","hooks_url":"https://api.github.com/repos/igoroogle/sort/hooks","issue_events_url":"https://api.github.com/repos/igoroogle/sort/issues/events{/number}","events_url":"https://api.github.com/repos/igoroogle/sort/events","assignees_url":"https://api.github.com/repos/igoroogle/sort/assignees{/user}","branches_url":"https://api.github.com/repos/igoroogle/sort/branches{/branch}","tags_url":"https://api.github.com/repos/igoroogle/sort/tags","blobs_url":"https://api.github.com/repos/igoroogle/sort/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/igoroogle/sort/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/igoroogle/sort/git/refs{/sha}","trees_url":"https://api.github.com/repos/igoroogle/sort/git/trees{/sha}","statuses_url":"https://api.github.com/repos/igoroogle/sort/statuses/{sha}","languages_url":"https://api.github.com/repos/igoroogle/sort/languages","stargazers_url":"https://api.github.com/repos/igoroogle/sort/stargazers","contributors_url":"https://api.github.com/repos/igoroogle/sort/contributors","subscribers_url":"https://api.github.com/repos/igoroogle/sort/subscribers","subscription_url":"https://api.github.com/repos/igoroogle/sort/subscription","commits_url":"https://api.github.com/repos/igoroogle/sort/commits{/sha}","git_commits_url":"https://api.github.com/repos/igoroogle/sort/git/commits{/sha}","comments_url":"https://api.github.com/repos/igoroogle/sort/comments{/number}","issue_comment_url":"https://api.github.com/repos/igoroogle/sort/issues/comments{/number}","contents_url":"https://api.github.com/repos/igoroogle/sort/contents/{+path}","compare_url":"https://api.github.com/repos/igoroogle/sort/compare/{base}...{head}","merges_url":"https://api.github.com/repos/igoroogle/sort/merges","archive_url":"https://api.github.com/repos/igoroogle/sort/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/igoroogle/sort/downloads","issues_url":"https://api.github.com/repos/igoroogle/sort/issues{/number}","pulls_url":"https://api.github.com/repos/igoroogle/sort/pulls{/number}","milestones_url":"https://api.github.com/repos/igoroogle/sort/milestones{/number}","notifications_url":"https://api.github.com/repos/igoroogle/sort/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/igoroogle/sort/labels{/name}","releases_url":"https://api.github.com/repos/igoroogle/sort/releases{/id}","deployments_url":"https://api.github.com/repos/igoroogle/sort/deployments","created_at":"2017-12-25T20:45:31Z","updated_at":"2017-12-25T20:45:31Z","pushed_at":"2018-01-27T12:36:02Z","git_url":"git://github.com/igoroogle/sort.git","ssh_url":"git@github.com:igoroogle/sort.git","clone_url":"https://github.com/igoroogle/sort.git","svn_url":"https://github.com/igoroogle/sort","homepage":null,"size":6,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"igoroogle:master","ref":"master","sha":"afc8b4068d5d7461b547f09bfbb511c200ff2897","user":{"login":"igoroogle","id":16157144,"avatar_url":"https://avatars2.githubusercontent.com/u/16157144?v=4","gravatar_id":"","url":"https://api.github.com/users/igoroogle","html_url":"https://github.com/igoroogle","followers_url":"https://api.github.com/users/igoroogle/followers","following_url":"https://api.github.com/users/igoroogle/following{/other_user}","gists_url":"https://api.github.com/users/igoroogle/gists{/gist_id}","starred_url":"https://api.github.com/users/igoroogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igoroogle/subscriptions","organizations_url":"https://api.github.com/users/igoroogle/orgs","repos_url":"https://api.github.com/users/igoroogle/repos","events_url":"https://api.github.com/users/igoroogle/events{/privacy}","received_events_url":"https://api.github.com/users/igoroogle/received_events","type":"User","site_admin":false},"repo":{"id":115362313,"name":"sort","full_name":"igoroogle/sort","owner":{"login":"igoroogle","id":16157144,"avatar_url":"https://avatars2.githubusercontent.com/u/16157144?v=4","gravatar_id":"","url":"https://api.github.com/users/igoroogle","html_url":"https://github.com/igoroogle","followers_url":"https://api.github.com/users/igoroogle/followers","following_url":"https://api.github.com/users/igoroogle/following{/other_user}","gists_url":"https://api.github.com/users/igoroogle/gists{/gist_id}","starred_url":"https://api.github.com/users/igoroogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igoroogle/subscriptions","organizations_url":"https://api.github.com/users/igoroogle/orgs","repos_url":"https://api.github.com/users/igoroogle/repos","events_url":"https://api.github.com/users/igoroogle/events{/privacy}","received_events_url":"https://api.github.com/users/igoroogle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/igoroogle/sort","description":null,"fork":false,"url":"https://api.github.com/repos/igoroogle/sort","forks_url":"https://api.github.com/repos/igoroogle/sort/forks","keys_url":"https://api.github.com/repos/igoroogle/sort/keys{/key_id}","collaborators_url":"https://api.github.com/repos/igoroogle/sort/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/igoroogle/sort/teams","hooks_url":"https://api.github.com/repos/igoroogle/sort/hooks","issue_events_url":"https://api.github.com/repos/igoroogle/sort/issues/events{/number}","events_url":"https://api.github.com/repos/igoroogle/sort/events","assignees_url":"https://api.github.com/repos/igoroogle/sort/assignees{/user}","branches_url":"https://api.github.com/repos/igoroogle/sort/branches{/branch}","tags_url":"https://api.github.com/repos/igoroogle/sort/tags","blobs_url":"https://api.github.com/repos/igoroogle/sort/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/igoroogle/sort/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/igoroogle/sort/git/refs{/sha}","trees_url":"https://api.github.com/repos/igoroogle/sort/git/trees{/sha}","statuses_url":"https://api.github.com/repos/igoroogle/sort/statuses/{sha}","languages_url":"https://api.github.com/repos/igoroogle/sort/languages","stargazers_url":"https://api.github.com/repos/igoroogle/sort/stargazers","contributors_url":"https://api.github.com/repos/igoroogle/sort/contributors","subscribers_url":"https://api.github.com/repos/igoroogle/sort/subscribers","subscription_url":"https://api.github.com/repos/igoroogle/sort/subscription","commits_url":"https://api.github.com/repos/igoroogle/sort/commits{/sha}","git_commits_url":"https://api.github.com/repos/igoroogle/sort/git/commits{/sha}","comments_url":"https://api.github.com/repos/igoroogle/sort/comments{/number}","issue_comment_url":"https://api.github.com/repos/igoroogle/sort/issues/comments{/number}","contents_url":"https://api.github.com/repos/igoroogle/sort/contents/{+path}","compare_url":"https://api.github.com/repos/igoroogle/sort/compare/{base}...{head}","merges_url":"https://api.github.com/repos/igoroogle/sort/merges","archive_url":"https://api.github.com/repos/igoroogle/sort/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/igoroogle/sort/downloads","issues_url":"https://api.github.com/repos/igoroogle/sort/issues{/number}","pulls_url":"https://api.github.com/repos/igoroogle/sort/pulls{/number}","milestones_url":"https://api.github.com/repos/igoroogle/sort/milestones{/number}","notifications_url":"https://api.github.com/repos/igoroogle/sort/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/igoroogle/sort/labels{/name}","releases_url":"https://api.github.com/repos/igoroogle/sort/releases{/id}","deployments_url":"https://api.github.com/repos/igoroogle/sort/deployments","created_at":"2017-12-25T20:45:31Z","updated_at":"2017-12-25T20:45:31Z","pushed_at":"2018-01-27T12:36:02Z","git_url":"git://github.com/igoroogle/sort.git","ssh_url":"git@github.com:igoroogle/sort.git","clone_url":"https://github.com/igoroogle/sort.git","svn_url":"https://github.com/igoroogle/sort","homepage":null,"size":6,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/igoroogle/sort/pulls/1"},"html":{"href":"https://github.com/igoroogle/sort/pull/1"},"issue":{"href":"https://api.github.com/repos/igoroogle/sort/issues/1"},"comments":{"href":"https://api.github.com/repos/igoroogle/sort/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/igoroogle/sort/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/igoroogle/sort/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/igoroogle/sort/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/igoroogle/sort/statuses/2d5f74e256597334e596fe46aa90f684cefdd362"}},"author_association":"OWNER"}}
{"actor":{"display_login":"ifsmirnov"}}