算法
一只勇敢的小蚂蚁
大数据新手,请多多指教
展开
-
单链表反转golang
type node struct { Num int NextNode *node}func (l *node) Next() bool { if l.NextNode == nil { return false } return true}// 头结点插入func headInsert(l *node) { tmp := l var newLink = new(node) newLink.Num = l.Num for tmp.Next() { tmp.原创 2021-07-22 17:50:33 · 71 阅读 · 0 评论 -
golang实现字符串匹配算法BF,KMP,Sunday,BM
golang实现字符串匹配算法BF,KMP,Sundayfunc printSubStr(i, j int, s, temp string) { str := s[i:] if i+j < len(s) { str = s[i : i+j+1] } fmt.Print(i, i+j, str, temp)}func BF(s, temp string) bool { for i := range s { for j := range temp { if i+j ==原创 2021-07-02 18:01:50 · 458 阅读 · 0 评论