{"id":23726611,"url":"https://github.com/codenkoffee/csen301-finals","last_synced_at":"2026-02-16T06:30:17.742Z","repository":{"id":215981518,"uuid":"739161798","full_name":"CodeNKoffee/csen301-finals","owner":"CodeNKoffee","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-08T17:56:05.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T00:33:44.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeNKoffee.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-04T23:11:22.000Z","updated_at":"2024-01-07T17:40:51.000Z","dependencies_parsed_at":"2024-12-31T00:32:37.111Z","dependency_job_id":"0f353f8c-241f-4d49-bf2b-1a1ac0a6565a","html_url":"https://github.com/CodeNKoffee/csen301-finals","commit_stats":null,"previous_names":["codenkoffee/csen301-finals"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeNKoffee%2Fcsen301-finals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeNKoffee%2Fcsen301-finals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeNKoffee%2Fcsen301-finals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeNKoffee%2Fcsen301-finals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeNKoffee","download_url":"https://codeload.github.com/CodeNKoffee/csen301-finals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239824980,"owners_count":19703199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-31T00:32:24.341Z","updated_at":"2026-02-16T06:30:17.707Z","avatar_url":"https://github.com/CodeNKoffee.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSEN301 FINALS TRIVIA\n\n## Clone a Linked List with next and Random Pointer\n\n1. **Create a New Node for Each Original Node and Insert It Next to the Original Node:**\n   - The linked list has nodes, and each node has two pointers: `next` points to the next node, and `arbit` points to any node in the list.\n   - We want to create a clone of the linked list. To do this, we traverse the original linked list.\n   - For each original node, we create a new node with the same data, and we insert it next to the original node. So, the structure becomes original_node -\u003e copy_node -\u003e original_node -\u003e copy_node -\u003e ...\n\n2. **Assign Random Pointers for the Copied Nodes:**\n   - Now, we need to set the `arbit` (random) pointers for the copied nodes.\n   - While traversing the list again, for each original node, if its `arbit` pointer is pointing to some node, we set the `arbit` pointer of its corresponding copy node to the corresponding copy node.\n\n3. **Separate the Original and Copied Linked Lists:**\n   - The linked list now contains both original and copied nodes interleaved.\n   - We need to separate the original and copied nodes into two separate linked lists.\n   - We update the `next` pointers of the original and copied nodes accordingly.\n\nHere's a step-by-step explanation:\n\n- **Step 1:**\n  ```\n  Original: 1 -\u003e 2 -\u003e 3 -\u003e 4\n  After Step 1: 1 -\u003e 1' -\u003e 2 -\u003e 2' -\u003e 3 -\u003e 3' -\u003e 4 -\u003e 4'\n  ```\n\n- **Step 2:**\n  ```\n  Original: 1 -\u003e 2 -\u003e 3 -\u003e 4\n  After Step 2: Set arbit pointers for copied nodes\n  ```\n\n- **Step 3:**\n  ```\n  Original: 1 -\u003e 2 -\u003e 3 -\u003e 4\n  Copied: 1' -\u003e 2' -\u003e 3' -\u003e 4'\n  After Step 3: Separate the original and copied linked lists\n  ```\n\nThe final result is a cloned linked list with both `next` and `arbit` pointers, created in O(N) time complexity.\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenkoffee%2Fcsen301-finals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodenkoffee%2Fcsen301-finals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenkoffee%2Fcsen301-finals/lists"}