{"id":21156054,"url":"https://github.com/itsmunim/bongotest","last_synced_at":"2025-07-07T01:05:23.281Z","repository":{"id":94201971,"uuid":"167411029","full_name":"itsmunim/bongotest","owner":"itsmunim","description":"Some simple enough algorithmic code test problems","archived":false,"fork":false,"pushed_at":"2019-01-27T17:51:11.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-30T20:48:27.804Z","etag":null,"topics":["algorithm","problem-solving","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/itsmunim.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}},"created_at":"2019-01-24T17:50:58.000Z","updated_at":"2019-01-28T15:01:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"dae85573-1551-423a-8289-54ffe34fae64","html_url":"https://github.com/itsmunim/bongotest","commit_stats":null,"previous_names":["itsmunim/bongotest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itsmunim/bongotest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmunim%2Fbongotest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmunim%2Fbongotest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmunim%2Fbongotest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmunim%2Fbongotest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsmunim","download_url":"https://codeload.github.com/itsmunim/bongotest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmunim%2Fbongotest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263996083,"owners_count":23541399,"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":["algorithm","problem-solving","python"],"created_at":"2024-11-20T11:35:13.043Z","updated_at":"2025-07-07T01:05:23.259Z","avatar_url":"https://github.com/itsmunim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Setup\n\n- `mkvirtualenv \u003cenv-name\u003e`\n- `pip install -r requirements.txt`\n- `python setup.py install` \u003c-- Important, otherwise module won't be found by `py.test`\n\n\n#### Running Test\n\n- `pytest -vv`\n\n\n#### Testing in iPython or Python Console\n\n##### Testing Depth of Object Keys (Problem 1 \u0026 2)\n\n```python\n\nfrom bongotest.depthcheck import get_depths, print_depth\n\n# A list of depth tuple(unordered), read the method docstring to know more\nget_depths({'a': 1, 'b': 2, 'c': {'d': 10, 'e': {'f': 11}}})\n\n\n# Prints the solution you expect from an object properly\nprint_depth({'a': 1, 'b': 2, 'c': {'d': 10, 'e': {'f': 11}}})\n```\n\n##### Testing Least Common Ancestor (Problem 3)\n\n```python\n\nfrom bongotest.datastructure import create_bst, get_node\nfrom bongotest.lca import lca\n\n# Create a bst first\nbst = create_bst()\n\n# Test lca for different nodes\nprint lca(bst[2], bst[4]).value\n\n```\n\n#### Complexity of the LCA Algorithm\n\n##### Runtime:\n\nIf we consider the height of the tree is `h`, then the time complexity is `O(h)`. Considering number\nof node to be `n`, this is more optimal than `O(n)`. This was possible because of the data structure as\nin every node has pointer to it's parent.\n\n##### Space:\n\nThe space complexity is constant `O(1)`; the reason being we don't store any path or info while running the\nalgorithm. The algorithm works based on calculating depth of two nodes and based on that deciding if\nit should go back upto the node where both has a convergence and hence the LCA is obtained.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsmunim%2Fbongotest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsmunim%2Fbongotest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsmunim%2Fbongotest/lists"}