1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 06:32:28 +08:00

rename: rename StackArray -> ArrayStack, StackLink -> LinkedStack

This commit is contained in:
dudaodong
2022-02-10 11:49:46 +08:00
parent 5ae746a1f0
commit 20e1836eb7
5 changed files with 12 additions and 312 deletions

View File

@@ -12,7 +12,7 @@ func NewLinkNode[T any](value T) *LinkNode[T] {
return &LinkNode[T]{value, nil, nil}
}
// StackNode is a node in stack, which have a Value and Pre points to previous node in the stack.
// StackNode is a node in stack, which have a Value and Next pointer points to next node in the stack.
type StackNode[T any] struct {
Value T
Next *StackNode[T]
@@ -22,3 +22,14 @@ type StackNode[T any] struct {
func NewStackNode[T any](value T) *StackNode[T] {
return &StackNode[T]{value, nil}
}
// QueueNode is a node in a queue, which have a Value and Next pointer points to next node in the queue.
type QueueNode[T any] struct {
Value T
Next *StackNode[T]
}
// NewQueueNode return a QueueNode pointer
func NewQueueNode[T any](value T) *QueueNode[T] {
return &QueueNode[T]{value, nil}
}