随笔分类 - 算法(Go)
加油,fighting,算法不能停
摘要:用bit位来构建集合,查找插入重复数据效率都非常高。 type IntSet struct { words []uint64 } // Has reports whether the set contains the non-negative value x. func (s *IntSet) Ha
阅读全文
摘要:归并排序 package main import ( "fmt" ) func mergeSort(low, high int, a *[]int) { if low >= high { return } mid := (low + high) / 2 mergeSort(low, mid, a)
阅读全文