From 0e86244559b157152840dcd0aebb50b90da3f78b Mon Sep 17 00:00:00 2001 From: dudaodong Date: Fri, 4 Feb 2022 09:21:35 +0800 Subject: [PATCH] refactor: rename linknode.go to node.go --- datastructure/linknode.go | 13 ------------- datastructure/singlylink.go | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 datastructure/linknode.go diff --git a/datastructure/linknode.go b/datastructure/linknode.go deleted file mode 100644 index bf89e31..0000000 --- a/datastructure/linknode.go +++ /dev/null @@ -1,13 +0,0 @@ -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} -} - diff --git a/datastructure/singlylink.go b/datastructure/singlylink.go index f63d601..a948206 100644 --- a/datastructure/singlylink.go +++ b/datastructure/singlylink.go @@ -5,7 +5,7 @@ import ( "fmt" ) -// SinglyLink is a linkedlist of node, which have a value and Pre points to previous node, Next points to a next node of the link. +// SinglyLink is a linked list. Whose node has a Value generics and Next pointer points to a next node of the link. type SinglyLink[T any] struct { Head *LinkNode[T] length int