感谢你对本项目的关注!我是 Jarry,来自中国的软件工程师。
Thank you for your interest in this project! We welcome all forms of contributions.
- 发现 Bug?请创建 Issue
- 有改进建议?请创建 Issue
- 文档有误?请创建 Issue
- Fork 本仓库
- 创建新分支:
git checkout -b feature/new-algorithm - 按照标准结构添加算法
- 确保代码通过测试
- 提交 Pull Request
algorithm-name/
├── README.md # 算法说明(必需)
├── implementations/ # 实现代码(至少3种语言)
│ ├── c/
│ ├── java/
│ ├── python/
│ ├── javascript/
│ ├── go/
│ └── typescript/
├── examples/ # 使用示例(推荐)
└── visuals/ # 可视化图片(推荐)
- 修正拼写错误
- 改进说明文字
- 添加更多示例
- 翻译文档
- 性能优化
- 代码重构
- 添加注释
- 修复 Bug
/**
* 函数功能简述
* @param arr 参数说明
* @param n 参数说明
* @return 返回值说明
*/
void bubble_sort(int arr[], int n) {
// 代码实现
// 添加详细注释
}/**
* 类功能简述
*/
public class BubbleSort {
/**
* 方法功能简述
* @param arr 参数说明
*/
public static void sort(int[] arr) {
// 代码实现
// 添加详细注释
}
}def bubble_sort(arr):
"""
函数功能简述
Args:
arr: 参数说明
Returns:
返回值说明
"""
# 代码实现
# 添加详细注释/**
* 函数功能简述
* @param {Array} arr - 参数说明
* @returns {Array} 返回值说明
*/
function bubbleSort(arr) {
// 代码实现
// 添加详细注释
}// BubbleSort 函数功能简述
// arr: 参数说明
func BubbleSort(arr []int) {
// 代码实现
// 添加详细注释
}每个算法实现都应包含测试代码:
// test.c
int main() {
int arr[] = {64, 34, 25, 12, 22, 11, 90};
int n = sizeof(arr) / sizeof(arr[0]);
bubble_sort(arr, n);
// 验证结果
assert(arr[0] == 11);
assert(arr[n-1] == 90);
printf("Test passed!\n");
return 0;
}# test_algorithm.py
import unittest
class TestBubbleSort(unittest.TestCase):
def test_basic(self):
arr = [64, 34, 25, 12, 22, 11, 90]
result = bubble_sort(arr)
self.assertEqual(result, [11, 12, 22, 25, 34, 64, 90])
def test_empty(self):
arr = []
result = bubble_sort(arr)
self.assertEqual(result, [])
if __name__ == '__main__':
unittest.main()- 算法名称 - 中英文
- 算法描述 - 用通俗语言解释
- 算法原理 - 详细说明工作原理
- 时间复杂度 - 最好/平均/最坏情况
- 空间复杂度 - 分析内存使用
- 代码示例 - 各语言实现链接
- 应用场景 - 实际使用场景
- 注意事项 - 常见问题和优化
# 冒泡排序 Bubble Sort
## 简介
冒泡排序是一种简单的排序算法...
## 算法原理
通过重复遍历要排序的数列...
## 复杂度分析
- 时间复杂度:O(n²)
- 空间复杂度:O(1)
## 实现代码
- [C 语言实现](./c/bubble_sort.c)
- [Java 实现](./java/BubbleSort.java)
- [Python 实现](./python/bubble_sort.py)
...
## 使用示例
...
## 注意事项
...- C:
algorithm_name.c,algorithm_name.h - Java:
AlgorithmName.java - Python:
algorithm_name.py - JavaScript:
algorithmName.js或algorithm-name.js - Go:
algorithm_name.go - TypeScript:
AlgorithmName.ts
- C:
snake_case-bubble_sort() - Java:
camelCase-bubbleSort() - Python:
snake_case-bubble_sort() - JavaScript:
camelCase-bubbleSort() - Go:
PascalCase-BubbleSort() - TypeScript:
camelCase-bubbleSort()
提交 Pull Request 前,请确保:
- 代码遵循项目的编码规范
- 添加了充分的代码注释
- 包含了测试用例
- 测试全部通过
- 更新了相关文档
- README.md 包含了所有必需内容
- 提交信息清晰明确
- 代码没有编译警告或错误
- 提交 Pull Request
- 维护者会在 3-5 个工作日内审查
- 根据反馈修改代码
- 审查通过后合并
- GitHub Issues:报告问题、提出建议
- GitHub Discussions:技术讨论、使用咨询
- Email:jarryli@gmail.com
- 尊重所有贡献者
- 保持友好和专业
- 接受建设性批评
- 专注于对项目最有利的方面
所有贡献者都将被列入项目的贡献者名单。
Thank you for contributing! 感谢你的贡献!
please concat jarryli@gmail.com or lichunping@buaa.edu.cn if you have any question.