Documentation
¶
Index ¶
- type LinkedList
- func (this *LinkedList) Append(element interface{})
- func (this *LinkedList) Clear()
- func (this *LinkedList) Delete(index int) interface{}
- func (this *LinkedList) GetElem(index int) interface{}
- func (this *LinkedList) Insert(index int, element interface{})
- func (this *LinkedList) Print()
- func (this *LinkedList) ToArray() []interface{}
- type LinkedListInterface
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkedList ¶
type LinkedList struct {
// contains filtered or unexported fields
}
单链表数据结构
func (*LinkedList) Append ¶
func (this *LinkedList) Append(element interface{})
func (*LinkedList) Clear ¶
func (this *LinkedList) Clear()
func (*LinkedList) Delete ¶
func (this *LinkedList) Delete(index int) interface{}
func (*LinkedList) GetElem ¶
func (this *LinkedList) GetElem(index int) interface{}
func (*LinkedList) Insert ¶
func (this *LinkedList) Insert(index int, element interface{})
func (*LinkedList) ToArray ¶
func (this *LinkedList) ToArray() []interface{}
ToArray 使用递归 + 闭包
@receiver this
@return []interface{}
type LinkedListInterface ¶
type LinkedListInterface interface {
// 插入操作,在结点之前插入
// @param int 第几个结点
// @param interface{} 插入的元素
Insert(int, interface{})
// 追加操作
// @param interface{}
Append(interface{})
// 删除操作
// @param int
// @return interface{}
Delete(int) interface{}
// 获取元素
// @param int
// @return interface{}
GetElem(int) interface{}
// 清空链表
Clear()
// 转换为数组
ToArray() []interface{}
// 打印链表
Print()
}
Click to show internal directories.
Click to hide internal directories.