{"action":"created","comment":{"url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/comments/194185721","pull_request_review_id":127320097,"id":194185721,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDE4NTcyMQ==","diff_hunk":"@@ -0,0 +1,198 @@\n+package assignment_2;\n+\n+import java.util.ArrayList;\n+import java.util.LinkedList;\n+import java.util.Queue;\n+import java.util.concurrent.LinkedBlockingDeque;\n+\n+/**\n+ *\n+ * @author Laura\n+ *  This program builds a binary tree by using three methods:\n+ *      1. add node in the left extremity\n+ *      2. add node in the right extremity\n+ *      3. add node in order to balance the tree with the possibility to skip \n+ *      insert locations\n+ * \n+ *  The method solving the first task is a recursive one, similar to searching a\n+ * node in a tree: when the given value is found, the method will return true, \n+ * but if the value was not found yet, we test if it was found in the current\n+ * subtree (in either left or right subtree of the current root) - if this is \n+ * true we add the root to solution and return true, else return false.\n+ * \n+ *  The method solving the second task uses the first method as follows:\n+ * there are two values given; for each one it finds its ancestors and it \n+ * searches the first common value.\n+ * \n+ */\n+\n+public class Ancestors {\n+    static class BinaryTreeNode<T> {\n+        BinaryTreeNode left, right;\n+        T value;\n+        \n+        BinaryTreeNode(T value) {\n+            this.value  = value;\n+        }\n+        \n+        // add to left extremity\n+        void addLeft(T newValue) {\n+            BinaryTreeNode aux = this;\n+            while(aux.left != null) {\n+                aux = aux.left;\n+            }\n+            BinaryTreeNode newNode = new BinaryTreeNode(newValue);\n+            aux.left = newNode;\n+        }\n+        \n+        // add to right extremity\n+        void addRight(T newValue) {\n+            BinaryTreeNode aux = this;\n+            while(aux.right != null) {\n+                aux = aux.right;\n+            }\n+            BinaryTreeNode newNode = new BinaryTreeNode(newValue);\n+            aux.right = newNode;\n+        }\n+        \n+        // add to balance tree\n+        // similar to bfs traversal\n+        void addBalanced(T newValue, int skips) { \n+            BinaryTreeNode aux = this;\n+            BinaryTreeNode newNode = new BinaryTreeNode(newValue);\n+            Queue<BinaryTreeNode> queue = new LinkedList();\n+            queue.add(aux);\n+            \n+            while(true) {\n+                BinaryTreeNode current = queue.poll();\n+                if(current.left != null)\n+                    queue.add(current.left);\n+                else {\n+                    if(skips != 0)\n+                        skips--;\n+                    else {\n+                        current.left = newNode;\n+                        break;\n+                    }\n+                }\n+                if(current.right != null)\n+                    queue.add(current.right);\n+                else {\n+                    if(skips != 0)\n+                        skips--;\n+                    else {\n+                        current.right = newNode;\n+                        break;\n+                    }\n+                }\n+            }\n+        }\n+        \n+        public String toString() {\n+            String s = \"\";\n+            BinaryTreeNode aux = this;\n+            Queue<BinaryTreeNode> q = new LinkedList();\n+            q.add(aux); ","path":"laurat007/assignment2/Ancestors.java","position":null,"original_position":95,"commit_id":"9fd2e4ceda931f3cefca87663d21a994c366e597","original_commit_id":"0786f159d43a43e29cda14d913a34396d24cbc05","user":{"login":"laurat007","id":28653585,"node_id":"MDQ6VXNlcjI4NjUzNTg1","avatar_url":"https://avatars3.githubusercontent.com/u/28653585?v=4","gravatar_id":"","url":"https://api.github.com/users/laurat007","html_url":"https://github.com/laurat007","followers_url":"https://api.github.com/users/laurat007/followers","following_url":"https://api.github.com/users/laurat007/following{/other_user}","gists_url":"https://api.github.com/users/laurat007/gists{/gist_id}","starred_url":"https://api.github.com/users/laurat007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurat007/subscriptions","organizations_url":"https://api.github.com/users/laurat007/orgs","repos_url":"https://api.github.com/users/laurat007/repos","events_url":"https://api.github.com/users/laurat007/events{/privacy}","received_events_url":"https://api.github.com/users/laurat007/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2018-06-08T21:27:59Z","updated_at":"2018-06-08T21:27:59Z","html_url":"https://github.com/flerdacodeu/CodeU-2018-Group3/pull/11#discussion_r194185721","pull_request_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/comments/194185721"},"html":{"href":"https://github.com/flerdacodeu/CodeU-2018-Group3/pull/11#discussion_r194185721"},"pull_request":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11"}},"in_reply_to_id":193885813},"pull_request":{"url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11","id":192373761,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMzczNzYx","html_url":"https://github.com/flerdacodeu/CodeU-2018-Group3/pull/11","diff_url":"https://github.com/flerdacodeu/CodeU-2018-Group3/pull/11.diff","patch_url":"https://github.com/flerdacodeu/CodeU-2018-Group3/pull/11.patch","issue_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/11","number":11,"state":"open","locked":false,"title":"Laurat007 2","user":{"login":"laurat007","id":28653585,"node_id":"MDQ6VXNlcjI4NjUzNTg1","avatar_url":"https://avatars3.githubusercontent.com/u/28653585?v=4","gravatar_id":"","url":"https://api.github.com/users/laurat007","html_url":"https://github.com/laurat007","followers_url":"https://api.github.com/users/laurat007/followers","following_url":"https://api.github.com/users/laurat007/following{/other_user}","gists_url":"https://api.github.com/users/laurat007/gists{/gist_id}","starred_url":"https://api.github.com/users/laurat007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurat007/subscriptions","organizations_url":"https://api.github.com/users/laurat007/orgs","repos_url":"https://api.github.com/users/laurat007/repos","events_url":"https://api.github.com/users/laurat007/events{/privacy}","received_events_url":"https://api.github.com/users/laurat007/received_events","type":"User","site_admin":false},"body":"This program solves both Q1 and Q2. I am not sure if the way I build my binary tree and the way I test the program are right.","created_at":"2018-06-04T11:10:41Z","updated_at":"2018-06-08T21:27:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17fc5675321f25b1b9f86c278b11fc1c5f94fd32","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11/commits","review_comments_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11/comments","review_comment_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/11/comments","statuses_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/statuses/9fd2e4ceda931f3cefca87663d21a994c366e597","head":{"label":"flerdacodeu:laurat007-2","ref":"laurat007-2","sha":"9fd2e4ceda931f3cefca87663d21a994c366e597","user":{"login":"flerdacodeu","id":28591648,"node_id":"MDQ6VXNlcjI4NTkxNjQ4","avatar_url":"https://avatars2.githubusercontent.com/u/28591648?v=4","gravatar_id":"","url":"https://api.github.com/users/flerdacodeu","html_url":"https://github.com/flerdacodeu","followers_url":"https://api.github.com/users/flerdacodeu/followers","following_url":"https://api.github.com/users/flerdacodeu/following{/other_user}","gists_url":"https://api.github.com/users/flerdacodeu/gists{/gist_id}","starred_url":"https://api.github.com/users/flerdacodeu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerdacodeu/subscriptions","organizations_url":"https://api.github.com/users/flerdacodeu/orgs","repos_url":"https://api.github.com/users/flerdacodeu/repos","events_url":"https://api.github.com/users/flerdacodeu/events{/privacy}","received_events_url":"https://api.github.com/users/flerdacodeu/received_events","type":"User","site_admin":false},"repo":{"id":133326551,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMzMjY1NTE=","name":"CodeU-2018-Group3","full_name":"flerdacodeu/CodeU-2018-Group3","owner":{"login":"flerdacodeu","id":28591648,"node_id":"MDQ6VXNlcjI4NTkxNjQ4","avatar_url":"https://avatars2.githubusercontent.com/u/28591648?v=4","gravatar_id":"","url":"https://api.github.com/users/flerdacodeu","html_url":"https://github.com/flerdacodeu","followers_url":"https://api.github.com/users/flerdacodeu/followers","following_url":"https://api.github.com/users/flerdacodeu/following{/other_user}","gists_url":"https://api.github.com/users/flerdacodeu/gists{/gist_id}","starred_url":"https://api.github.com/users/flerdacodeu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerdacodeu/subscriptions","organizations_url":"https://api.github.com/users/flerdacodeu/orgs","repos_url":"https://api.github.com/users/flerdacodeu/repos","events_url":"https://api.github.com/users/flerdacodeu/events{/privacy}","received_events_url":"https://api.github.com/users/flerdacodeu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flerdacodeu/CodeU-2018-Group3","description":null,"fork":false,"url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3","forks_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/forks","keys_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/teams","hooks_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/hooks","issue_events_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/events{/number}","events_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/events","assignees_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/assignees{/user}","branches_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/branches{/branch}","tags_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/tags","blobs_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/refs{/sha}","trees_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/statuses/{sha}","languages_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/languages","stargazers_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/stargazers","contributors_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/contributors","subscribers_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/subscribers","subscription_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/subscription","commits_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/commits{/sha}","git_commits_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/commits{/sha}","comments_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/comments{/number}","issue_comment_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/comments{/number}","contents_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/contents/{+path}","compare_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/merges","archive_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/downloads","issues_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues{/number}","pulls_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls{/number}","milestones_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/milestones{/number}","notifications_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/labels{/name}","releases_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/releases{/id}","deployments_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/deployments","created_at":"2018-05-14T08:06:22Z","updated_at":"2018-06-08T14:57:32Z","pushed_at":"2018-06-08T21:25:31Z","git_url":"git://github.com/flerdacodeu/CodeU-2018-Group3.git","ssh_url":"git@github.com:flerdacodeu/CodeU-2018-Group3.git","clone_url":"https://github.com/flerdacodeu/CodeU-2018-Group3.git","svn_url":"https://github.com/flerdacodeu/CodeU-2018-Group3","homepage":null,"size":142,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"flerdacodeu:master","ref":"master","sha":"3dc6d347002d0b365e15e41d46aa1f778fdbf2ac","user":{"login":"flerdacodeu","id":28591648,"node_id":"MDQ6VXNlcjI4NTkxNjQ4","avatar_url":"https://avatars2.githubusercontent.com/u/28591648?v=4","gravatar_id":"","url":"https://api.github.com/users/flerdacodeu","html_url":"https://github.com/flerdacodeu","followers_url":"https://api.github.com/users/flerdacodeu/followers","following_url":"https://api.github.com/users/flerdacodeu/following{/other_user}","gists_url":"https://api.github.com/users/flerdacodeu/gists{/gist_id}","starred_url":"https://api.github.com/users/flerdacodeu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerdacodeu/subscriptions","organizations_url":"https://api.github.com/users/flerdacodeu/orgs","repos_url":"https://api.github.com/users/flerdacodeu/repos","events_url":"https://api.github.com/users/flerdacodeu/events{/privacy}","received_events_url":"https://api.github.com/users/flerdacodeu/received_events","type":"User","site_admin":false},"repo":{"id":133326551,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMzMjY1NTE=","name":"CodeU-2018-Group3","full_name":"flerdacodeu/CodeU-2018-Group3","owner":{"login":"flerdacodeu","id":28591648,"node_id":"MDQ6VXNlcjI4NTkxNjQ4","avatar_url":"https://avatars2.githubusercontent.com/u/28591648?v=4","gravatar_id":"","url":"https://api.github.com/users/flerdacodeu","html_url":"https://github.com/flerdacodeu","followers_url":"https://api.github.com/users/flerdacodeu/followers","following_url":"https://api.github.com/users/flerdacodeu/following{/other_user}","gists_url":"https://api.github.com/users/flerdacodeu/gists{/gist_id}","starred_url":"https://api.github.com/users/flerdacodeu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerdacodeu/subscriptions","organizations_url":"https://api.github.com/users/flerdacodeu/orgs","repos_url":"https://api.github.com/users/flerdacodeu/repos","events_url":"https://api.github.com/users/flerdacodeu/events{/privacy}","received_events_url":"https://api.github.com/users/flerdacodeu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flerdacodeu/CodeU-2018-Group3","description":null,"fork":false,"url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3","forks_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/forks","keys_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/teams","hooks_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/hooks","issue_events_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/events{/number}","events_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/events","assignees_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/assignees{/user}","branches_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/branches{/branch}","tags_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/tags","blobs_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/refs{/sha}","trees_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/statuses/{sha}","languages_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/languages","stargazers_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/stargazers","contributors_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/contributors","subscribers_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/subscribers","subscription_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/subscription","commits_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/commits{/sha}","git_commits_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/git/commits{/sha}","comments_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/comments{/number}","issue_comment_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/comments{/number}","contents_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/contents/{+path}","compare_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/merges","archive_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/downloads","issues_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues{/number}","pulls_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls{/number}","milestones_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/milestones{/number}","notifications_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/labels{/name}","releases_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/releases{/id}","deployments_url":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/deployments","created_at":"2018-05-14T08:06:22Z","updated_at":"2018-06-08T14:57:32Z","pushed_at":"2018-06-08T21:25:31Z","git_url":"git://github.com/flerdacodeu/CodeU-2018-Group3.git","ssh_url":"git@github.com:flerdacodeu/CodeU-2018-Group3.git","clone_url":"https://github.com/flerdacodeu/CodeU-2018-Group3.git","svn_url":"https://github.com/flerdacodeu/CodeU-2018-Group3","homepage":null,"size":142,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11"},"html":{"href":"https://github.com/flerdacodeu/CodeU-2018-Group3/pull/11"},"issue":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/11"},"comments":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/flerdacodeu/CodeU-2018-Group3/statuses/9fd2e4ceda931f3cefca87663d21a994c366e597"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"laurat007"}}