From 10ed71a3a28a8eb130c4f93ee390f391ee0cf057 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Fri, 4 Feb 2022 09:22:16 +0800 Subject: [PATCH] refactor: rename linknode.go to node.go --- datastructure/node.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 datastructure/node.go diff --git a/datastructure/node.go b/datastructure/node.go new file mode 100644 index 0000000..bf89e31 --- /dev/null +++ b/datastructure/node.go @@ -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} +} +