{"id":44695382,"url":"https://github.com/vogo/goalg","last_synced_at":"2026-02-15T08:09:40.897Z","repository":{"id":57621659,"uuid":"268937153","full_name":"vogo/goalg","owner":"vogo","description":"golang algorithm implement for leetcode and data structures","archived":false,"fork":false,"pushed_at":"2020-07-08T08:17:08.000Z","size":77,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T13:19:05.636Z","etag":null,"topics":["algorithms","data-structure","golang","leetcode"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vogo.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}},"created_at":"2020-06-03T00:24:41.000Z","updated_at":"2020-07-11T11:03:36.000Z","dependencies_parsed_at":"2022-08-26T23:10:34.799Z","dependency_job_id":null,"html_url":"https://github.com/vogo/goalg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vogo/goalg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogo%2Fgoalg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogo%2Fgoalg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogo%2Fgoalg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogo%2Fgoalg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vogo","download_url":"https://codeload.github.com/vogo/goalg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogo%2Fgoalg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29473465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T06:58:05.414Z","status":"ssl_error","status_checked_at":"2026-02-15T06:58:05.085Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["algorithms","data-structure","golang","leetcode"],"created_at":"2026-02-15T08:09:40.448Z","updated_at":"2026-02-15T08:09:40.891Z","avatar_url":"https://github.com/vogo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goalg\n\n[![Build Status](https://travis-ci.org/vogo/goalg.png?branch=master)](https://travis-ci.org/vogo/goalg)\n[![codecov](https://codecov.io/gh/vogo/goalg/branch/master/graph/badge.svg)](https://codecov.io/gh/vogo/goalg)\n[![GoDoc](https://godoc.org/github.com/vogo/goalg?status.svg)](https://godoc.org/github.com/vogo/goalg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/vogo/goalg)](https://goreportcard.com/report/github.com/vogo/goalg)\n![license](https://img.shields.io/badge/license-Apache--2.0-green.svg)\n\n## 二分查找\n   \n**核心思想**: \n- 给定排序的数组，选定中间位置，和目标值比较；\n- 如果小于目标值，则在左侧继续查找；\n- 如果大于目标值，则在右侧继续查找。\n\n**算法关键**: \n- mid在边界情况时取值: `r = l + 1` 情况下, 即左右指针相邻的情况, `mid = l = l + (r - l)/2`,  `mid = r = l + (r - l + 1)/2`;\n- 避免死循环: 确保以上边界情况 l 或 r 的值变化后下一次循环mid取得不同的值，或能跳出循环。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvogo%2Fgoalg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvogo%2Fgoalg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvogo%2Fgoalg/lists"}