1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 14:42:27 +08:00

feat: add some functons of singlelink

This commit is contained in:
dudaodong
2022-02-02 22:41:49 +08:00
parent 70077a6010
commit 3546afe86c
3 changed files with 173 additions and 7 deletions

13
datastructure/linknode.go Normal file
View File

@@ -0,0 +1,13 @@
package datastructure
// LinkNode is a linkedlist node, which have a value and Pre points to previous node, Next points to a next node of the link.
type LinkNode[T any] struct {
Value T
Pre *LinkNode[T]
Next *LinkNode[T]
}
func NewLinkNode[T any](value T) *LinkNode[T] {
return &LinkNode[T]{value, nil, nil}
}