{"id":26875257,"url":"https://github.com/hxndev/search-integer-in-a-grid-using-divide-and-conquer","last_synced_at":"2025-08-24T14:16:40.907Z","repository":{"id":107914282,"uuid":"375897522","full_name":"HxnDev/Search-integer-in-a-Grid-using-Divide-and-Conquer","owner":"HxnDev","description":"Divide and Conquer technique is used to work out different problems of varyying natures. Our problem at hand is to efficiently search an integer value from grid of size n x n, where n is any integer, using the principles of divide and conquer. The grid has both it's rows as well as columns sorted in ascending order.","archived":false,"fork":false,"pushed_at":"2021-06-11T04:05:35.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T10:41:06.543Z","etag":null,"topics":["algortihm","code","complexity","cpp","divide-and-conquer","grid","integer","search","time-complexity-analysis"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HxnDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2021-06-11T03:49:52.000Z","updated_at":"2022-06-18T06:22:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"3208d35c-bba3-4c00-bc44-85a83fff5c84","html_url":"https://github.com/HxnDev/Search-integer-in-a-Grid-using-Divide-and-Conquer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HxnDev/Search-integer-in-a-Grid-using-Divide-and-Conquer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HxnDev%2FSearch-integer-in-a-Grid-using-Divide-and-Conquer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HxnDev%2FSearch-integer-in-a-Grid-using-Divide-and-Conquer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HxnDev%2FSearch-integer-in-a-Grid-using-Divide-and-Conquer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HxnDev%2FSearch-integer-in-a-Grid-using-Divide-and-Conquer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HxnDev","download_url":"https://codeload.github.com/HxnDev/Search-integer-in-a-Grid-using-Divide-and-Conquer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HxnDev%2FSearch-integer-in-a-Grid-using-Divide-and-Conquer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271884879,"owners_count":24838558,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["algortihm","code","complexity","cpp","divide-and-conquer","grid","integer","search","time-complexity-analysis"],"created_at":"2025-03-31T10:39:33.023Z","updated_at":"2025-08-24T14:16:40.900Z","avatar_url":"https://github.com/HxnDev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Search-integer-in-a-Grid-using-Divide-and-Conquer\n\n## Part A (Algorithm)\n\n```\n- Declare i as zero so it starts from the first element\n- Declare j as “n (size of array)” so it may start from the last element\n- We will use a loop which will run **“i”** from **_0 - n_** and **“j”** from **_(n- 1 )- 0_**.\n- If the element is found at the initial location (i.e. [i][j]), then it will print it.\n- If the number at given location is greater than the number we want to search (i.e. [i][j] \u003e val), then we\n    will decrement ‘j’ so that we compare the next small value in that row.\n- If the number at given location is smaller than the number we want to search (i.e. [i][j] \u003c val), then we\n    will increment ‘i’ so that we compare the next large value in the next row.\n- This loop will keep running till it finds the value we are looking for\n- If value is not present, it will return error message.\n```\n\n## Part B (Code)\n\n```\nAttached in the main branch. The file name is \"Temp.cpp\" and \"Temp.vcxproj\".\n(Note: You can simply double click “temp.vcxproj” file. It will directly open the project and\nyou can then simply click “Run”)\n```\n\n## Part C (Time Complexity)\n\n```\nThe time complexity of my algorithm will O(n²) in the worst case. As in the worst case, the\nelement to be found will be in _location [n][ 0 ]._ **Divide and Conquer** is being used in the function too. The element to\nbe searched is compared and if it is less/greater, action is taken accordingly. For instance, if the element to be searched\nis greater than the element on current row \u0026 column, we will simply jump to the next row instead of checking the\ncurrent row further. Similarly, if the element to be found is nowhere, then the loop will continue to iterate and will\ncause searching every element of the last row, hence time complexity will be O(n²). Further breakdown of the time\ncomplexity is as follows:\n\n- Variable declaration = 1 + 1 = 2\n- While loop = nxn ( 1 st n = i (0-n), 2 nd n = j ((n- 1 )-0))\n- If conditions = 1 + 1 + 1 = 3\n```\n\n## For further queries contact me at : chhxnshah@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhxndev%2Fsearch-integer-in-a-grid-using-divide-and-conquer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhxndev%2Fsearch-integer-in-a-grid-using-divide-and-conquer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhxndev%2Fsearch-integer-in-a-grid-using-divide-and-conquer/lists"}