{"id":21239573,"url":"https://github.com/ahmedabougabal/cppsolvingdatastructuresassignments","last_synced_at":"2025-03-15T03:41:28.768Z","repository":{"id":261550238,"uuid":"884299271","full_name":"ahmedabougabal/CppSolvingDataStructuresAssignments","owner":"ahmedabougabal","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-12T20:38:18.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T19:26:09.660Z","etag":null,"topics":["assignment-solutions","binary-search-tree","cpp","linked-list","tree-structure"],"latest_commit_sha":null,"homepage":"","language":"C++","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/ahmedabougabal.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-11-06T14:00:11.000Z","updated_at":"2025-01-12T20:38:22.000Z","dependencies_parsed_at":"2024-11-07T06:33:23.956Z","dependency_job_id":"f50bd448-01c8-46b1-9666-30f609bfa74a","html_url":"https://github.com/ahmedabougabal/CppSolvingDataStructuresAssignments","commit_stats":null,"previous_names":["ahmedabougabal/cppsolvingdatastructuresassignments"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedabougabal%2FCppSolvingDataStructuresAssignments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedabougabal%2FCppSolvingDataStructuresAssignments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedabougabal%2FCppSolvingDataStructuresAssignments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedabougabal%2FCppSolvingDataStructuresAssignments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmedabougabal","download_url":"https://codeload.github.com/ahmedabougabal/CppSolvingDataStructuresAssignments/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243680975,"owners_count":20330155,"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":["assignment-solutions","binary-search-tree","cpp","linked-list","tree-structure"],"created_at":"2024-11-21T00:44:09.655Z","updated_at":"2025-03-15T03:41:28.760Z","avatar_url":"https://github.com/ahmedabougabal.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CppSolvingDataStructuresAssignments\n\n**_I will document some of my DataStructures taken notes here._**\n\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)\n[![Project Status](https://img.shields.io/badge/status-Still%20in%20Progress-yellow)](https://github.com/yourusername/mernStackMilestoneProject_ITI)\n![Binary Tree](https://img.shields.io/badge/Data%20Structure-Binary%20Tree-blue)\n![Linked List](https://img.shields.io/badge/Data%20Structure-Linked%20List-brightgreen)\n\n![Profile Views](https://komarev.com/ghpvc/?username=ahmedabougabal\u0026color=brightgreen)\n\n# Trees\n\n- trees are used to store information.\n- tree is usually upside down.\n- each circle is called a node or a vertex.\n- link between 2 nodes is an edge.\n\n![image](https://github.com/user-attachments/assets/52695b9b-7247-4b18-a50b-0f12cf44c5b0)\n\n- from the above tree, we deduce the following. . .\n- the edge is the distance (connection) between 2 nodes, node 5 has no edge with node 4\n- [Tree with n nodes has n - 1 edges](https://www.cs.purdue.edu/homes/spa/courses/sa12/mod8.pdf)\n- the tree has 4 levels, levels (0,1,2,3)\n- Node(1) has 2 children: 2 and 3\n- The parent of Node(7) is node(2)\n- Nodes {5, 9} are siblings (brothers)\n- height (specific to each node) represents the number of edges on the longest downward path between a node(vertex) and a leaf.\n- Tree of N levels has N-1 heights, since that the tree above has 4 levels, then the height is 4-1 = 3 edges\n- the height of the node 1 (root) is 3 (start from the root to the longest path downward to the farest leaf)\n- node 7 has a height = 0\n- Node's Depth : the number of edges from the node to the root node.\n  **_Difference between Depth and Height_**\n  - depth is specific about 2 nodes (root node and the current node only)\n  - height is going down from the node to the leaves. (height is about my current node and any other node (leaf) i can reach - longest path)\n- there is only 1 path between any 2 nodes. (you are now at the root node and you wanted to go to the node 4, then there is only 1 way (simple tree)\n- in a tree where every node has only 1 single parent, then there is only 1 path from a node to another.\n\n**Sub Trees**\n\n- recursive nature where each tree has a subtree and each subtree has another subtree.\n- Problem solving tip: we deduce that when we want to get the elements of a tree, we will do this recursively.\n\n# Binary Trees\n\n- a tree where each node at least has at most 2 children (left and right nodes).\n- a leaf node is a node with no children.\n\n**this is a simple tree (a node has many children)**\n![image](https://github.com/user-attachments/assets/896209b1-7bba-4d07-bdcd-c1a92d3d5433)\n\n**this is a binary tree (each node has at most 2 children)**\n![image](https://github.com/user-attachments/assets/61f26fc1-cb60-4e11-9841-9947f31100fe)\n\n-- A linked List is a special case of a binary tree.\n\n# binary tree traversal 1\n\ntraversal is a way of walking through an elements of a data structure.\n\nwe need to create an expression tree (leaves are operands and others are operators)\n\ncan draw this tree : (2+3)\\*4\n\n# types of traversal\n\n- LVR (left, visit, right) --\u003e in order traversal\n\u003cbr /\u003e\nhow to know the printed nodes visually ?\n\u003cbr /\u003e\n\nproject down each node and read from left to right, this is how the binary tree is represented visually as shown.\n\n\n![image](https://github.com/user-attachments/assets/8b68607a-96a2-425a-b7f7-d9367194e1f5)\n\n---\n\n- LRV (left, right, visit) --\u003e post order traversal\n\n --\u003e left first, then right first , then printing the nodes \n\n how to deduce the printed nodes visually ? \n \njust in 2 steps : \n\n**step 1**\nfor every node , if it doesnot have a right , then project it down, what if it does have a right node? --\u003e wait for it \n\n**step 2**\n\nfor the nodes that have a right node , project it down after its right node.\n\nnote that, when projecting the nodes in step 2 , we go from bottom to up level by level.\n\n![image](https://github.com/user-attachments/assets/80d4a03b-e2d0-4145-be93-954e771f2893)\n\n---\n\n- VLR (visit, left, right) --\u003e preorder traversal\n\n how to deduce the printed nodes visually ? \n\nwill be the opposite of the post order traversal (2 steps)\n\n**step 1**\nfor every node , if it doesnot have a left, then project it down, what if it does have a left node? --\u003e wait for it \n\n**step 2**\nthen we project the nodes that have a left node before its left subtrees \n\n\n- note that, when projecting the nodes in step 2 , we go from bottom to up level by level.\n\n\n![image](https://github.com/user-attachments/assets/83789541-068c-4e8d-b1b2-738d01c9af96)\n\n\n\n---\n\n\u003cdiv align=\"center\" style=\"background-color: #f9f9f9; padding: 15px; border-radius: 10px; border: 1px solid #e1e4e8;\"\u003e\n  \u003ch3\u003e⚠️ Heads Up!\u003c/h3\u003e\n  \u003cp\u003e\u003cstrong\u003eThis ReadMe is under constant updates.\u003c/strong\u003e\u003c/p\u003e\n  \u003cp\u003eStay tuned for new notes, revisions, and insights as I continue building this repository. 📚💡\u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n# Acknowledgments\n\n\u003e Thanks to Dr.Moustafa Saad, Nidal Fikri\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedabougabal%2Fcppsolvingdatastructuresassignments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmedabougabal%2Fcppsolvingdatastructuresassignments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedabougabal%2Fcppsolvingdatastructuresassignments/lists"}