{"id":16583204,"url":"https://github.com/manid2/dsa","last_synced_at":"2025-10-29T07:32:04.762Z","repository":{"id":108781169,"uuid":"504928689","full_name":"manid2/dsa","owner":"manid2","description":"Data structures and algorithms code.","archived":false,"fork":false,"pushed_at":"2024-10-29T17:10:04.000Z","size":237,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T18:38:48.917Z","etag":null,"topics":["algorithms","data-structures","interview","leetcode","leetcode-solutions"],"latest_commit_sha":null,"homepage":"http://manid2-dsa.readthedocs.io/","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manid2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"custom":"https://buymeacoffee.com/manid2"}},"created_at":"2022-06-18T19:05:34.000Z","updated_at":"2024-09-20T05:31:57.000Z","dependencies_parsed_at":"2024-06-17T05:28:55.960Z","dependency_job_id":"61f2d783-2dd9-4e3b-a450-df4b03f30d16","html_url":"https://github.com/manid2/dsa","commit_stats":null,"previous_names":["manid2/data-structures-algorithms","manid2/dsa"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manid2%2Fdsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manid2%2Fdsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manid2%2Fdsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manid2%2Fdsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manid2","download_url":"https://codeload.github.com/manid2/dsa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238791864,"owners_count":19531026,"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":["algorithms","data-structures","interview","leetcode","leetcode-solutions"],"created_at":"2024-10-11T22:35:10.013Z","updated_at":"2025-10-29T07:31:59.421Z","avatar_url":"https://github.com/manid2.png","language":"C++","funding_links":["https://buymeacoffee.com/manid2"],"categories":[],"sub_categories":[],"readme":"Data structures and algorithms (DSA)\n====================================\n\nThe purpose of this repository is to help me prepare for online assessments,\nprogramming competitions and software engineering interviews along with the\nbenefit of practicing in the programming language I currently (year 2024) work\nin i.e. C++.\n\nI had used C and Python 3 for previous practice sessions so that code is\nretained but no new code is pushed due to me using C++ full time so I gain\nexpertise in that.\n\nFor these practice programs I have borrowed working code from various online\nsources and relevant credits are given in code comments.  So I hope anyone who\nfinds this repository may use it for their own learning of data structures and\nalgorithms. After learning from working solutions in this repository you may\npractice solving problems on coding contest platforms with time limit.\n\nUse the code and documentation in this repository freely and share it with the\nothers.\n\nCoding guidelines\n-----------------\n\n* Focus on C++ code and for online assessments, coding competition especially\n  for platforms such as HackerRank, LeetCode.\n* Fully working single source files with no external dependencies as required\n  for coding competitions.\n* Every C++ source file must build \u0026 run as a single file target the focus is\n  on solving the problem correctly.\n* Each C++ compiled binary must output test result as a single line in this\n  format `Executed M implementations with N tests.`.  This makes it easy to\n  get tests summary.\n* For debugging each binary must print test name, test case number with input\n  and output in this format and only when enabled with environment variable\n  `SHOW_TEST_OUTPUT`:\n\n  ```text\n  Testing implementation M \u003cName\u003e\n    test-0:  input: \u003ci1 = v1\u003e, \u003ciX = vX\u003e  output: \u003co = v\u003e\n    ...\n    test-N:  input: \u003ci1 = v1\u003e, \u003ciX = vX\u003e  output: \u003co = v\u003e\n  Executed M implementations with N tests.\n  ```\n\n* Must use latest C++ version (as of now C++20) to be updated with the latest\n  additions, improvements to C++ and STL library.\n\nBuild \u0026 test\n------------\n\nThis repository requires Gnu g++ compiler minimum version 13 to support C++20\nfeatures such as `std::format()` used in code.\n\nThis repository uses Gnu Makefile to run build and test tasks along with some\nhelper tasks such as to run formatter, linter for source code.\n\nBuild is tested and tests are verified on Gnu/Linux \u0026 Cygwin (Windows)\noperating systems.\n\n### Examples\n\n```bash\nmake venv # setup python virtual environment\nmake docs # generate sphinx docs\n\nmake cpp/arrays/2sum-01        # build a test binary from .cpp source file\nmake cpp/arrays/2sum-01-check  # run the test binary\nmake cpp/arrays/2sum-01-format # format .cpp source file\n\nSHOW_TEST_OUTPUT=1 make cpp/arrays/2sum-01-check # run test with debug output\n```\n\nTest framework\n--------------\n\nThis repository uses a single header file test \"framework\" to write test cases\nto verify the correctness of the algorithms and various implementations.  It\nis designed to execute test cases by providing definition to `TEST()` macros\nwith unique and name description to that test.  This step registers the test\nwith the tests registry.\n\nTo check the test conditions with expected and actual values it provides\n`CHECK_EQ()` macro.  It checks a given condition and increments test case\ncount on success and reports error and exits on failure.  To convert the\nexpected \u0026 actual data into printable strings helper functions such as\n`to_string()` have to be provided.  Use `SUCCESS()` \u0026 `FAIL()` macros to\ncreate custom checks not provided by the framework.\n\nThe test output can be printed with `SHOW_OUTPUT()` macro to verify the inputs\npassed to an algorithm and the output received from it.  The output can be\nmanipulated by providing the list of IO manipulators to `SET_IO()` and reset\nwith `RESET_IO()`. Custom test can be provided using `SET_CUSTOM_FAIL_MSG()`\nor by providing `to_string()` overloads.\n\nThe test code is initialized with `INIT_TEST_MAIN()` macro that provides\n`main()` function definition which includes `RUN_ALL_TESTS()` macro function\nto run all the registered tests.\n\nThis framework removes the need to write test output and test logic code\nacross the implementations significantly reducing the number of source lines\nin a single file and  improves readability.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanid2%2Fdsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanid2%2Fdsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanid2%2Fdsa/lists"}