数据结构
辛勤的搬砖者
这个作者很懒,什么都没留下…
展开
-
【数据结构连载一栈】【四则运算--后缀表达式】python
class Node(object): def __init__(self, data=None): self.data = data self.next = None def __str__(self): return "数据:{data},地址:{next}".format(data=self.data, next=id(self.next)) class LinkedStack(object): def __init__(.原创 2021-05-14 16:43:45 · 255 阅读 · 0 评论 -
【数据结构连载一栈】【四则运算--后缀表达式】javascript
function Node(value) { this.data = value; this.next = null; } function LinkedStack() { this.head = null; this._length = 0; this.clear = function () { this.head = null; this._length = 0; }; this.empty = function原创 2021-05-14 16:42:53 · 163 阅读 · 0 评论 -
【数据结构连载一栈】【四则运算--后缀表达式】golang
package main import ( "fmt" "strconv" "strings" ) type Node struct { data interface{} next *Node } type LinkedStack struct { length int head *Node } func NewLinkedStack() LinkedStack { return LinkedStack{length: 0, head: nil} } func (s *Linke原创 2021-05-14 16:42:00 · 268 阅读 · 0 评论 -
【数据结构连载一栈】【斐波那契数列】golang
package main import "fmt" // FibonacciFor 循环 func FibonacciFor(num int) []int { a := 0 b := 1 l := make([]int, 0) for i := 0; i < num; i++ { l = append(l, a) tmp := a a = b b = tmp + a } return l } // FibonacciRecursive 递归 func fibonacc原创 2021-05-14 16:40:16 · 98 阅读 · 0 评论 -
【数据结构连载一栈】【斐波那契数列】javascript
// 循环 function fibonacci_for(num) { let l = []; let a = 0; let b = 1; for (let i = 0; i < num; i++) { l.push(a); const tmp = a; a = b; b = tmp + b; } return l; } // 递归 function fibonacci_recursive原创 2021-05-14 16:39:36 · 74 阅读 · 0 评论 -
【数据结构连载一栈】【斐波那契数列】python
# 循环 def fibonacci_for(num): a, b = 0, 1 l = [] for i in range(num): l.append(a) a, b = b, a + b return l # 递归 def fibonacci_recursive(num): l = [] def fibonacci(num): if num == 0: return 0 .原创 2021-05-14 16:38:48 · 105 阅读 · 0 评论 -
【数据结构连载一栈】【链式存储栈】golang
package main import "fmt" type Node struct { data interface{} next *Node } type LinkedStack struct { length int head *Node } func NewLinkedStack() LinkedStack { return LinkedStack{length: 0, head: nil} } func (s *LinkedStack) Clear() { s.length原创 2021-05-14 16:37:10 · 60 阅读 · 0 评论 -
【数据结构连载一栈】【链式存储栈】javascript
function Node(value) { this.data = value; this.next = null; } function LinkedStack() { this.head = null; this._length = 0; this.clear = function () { this.head = null; this._length = 0; }; this.empty = function原创 2021-05-14 16:36:26 · 55 阅读 · 0 评论 -
【数据结构连载一栈】【链式存储栈】python
class Node(object): def __init__(self, data=None): self.data = data self.next = None def __str__(self): return "数据:{data},地址:{next}".format(data=self.data, next=id(self.next)) class LinkedStack(object): def __init__(s原创 2021-05-14 16:35:39 · 71 阅读 · 0 评论 -
【数据结构连载一栈】【顺序存储栈】python
# -*- coding: UTF-8 -*- class ListStack(object): def __init__(self, max_size): self._max_size = max_size self._stack = [None] * self._max_size self._top = -1 self._length = 0 def clear(self): self._stack =原创 2021-05-08 16:43:02 · 60 阅读 · 0 评论 -
【数据结构连载一栈】【顺序存储栈】golang
package main import "fmt" type ListStack struct { top int stack []interface{} length int maxSize int } func NewListStack(maxSize int) ListStack { return ListStack{ top: -1, stack: make([]interface{}, maxSize), length: 0, maxSi原创 2021-05-08 16:42:24 · 101 阅读 · 0 评论 -
【数据结构连载一栈】【顺序存储栈】javascript
function ListStack(maxSize) { this.maxSize = maxSize; this.stack = new Array(maxSize); this.top = -1; this._length = 0; this.clear = function () { this.stack = new Array(maxSize); this.top = -1; this._length = 0;原创 2021-05-08 16:41:39 · 79 阅读 · 0 评论 -
【数据结构连载一线性表】【双向循环链表】golang
package main import ( "fmt" "strconv" ) type Node struct { data interface{} pre *Node next *Node } type DoubleLinkedList struct { length int head *Node } func NewDoubleLinkedList() DoubleLinkedList { node := Node{} l := DoubleLinkedList{原创 2021-05-08 16:25:23 · 115 阅读 · 1 评论 -
【数据结构连载一线性表】【双向循环链表】python
# -*- coding: UTF-8 -*- """ 线性表之链式存储结构 双向循环链表 基本操作: 初始化 __init__ 线性表空判断 empty 清空线性表 clear 获取元素 get 是否存在数据 exist 插入操作 insert 删除操作 delete 线性表的长度 length 扩展操作 遍历链表原创 2021-05-08 16:24:34 · 54 阅读 · 0 评论 -
【数据结构连载一线性表】【双向循环链表】javascript
function Node() { this.data = null; this.next = null; this.pre = null; } function DoubleCycleLinkedList() { this.length = 0; this.head = new Node(); this.head.pre = this.head; this.head.next = this.head; this.tail = functio原创 2021-05-08 16:26:04 · 45 阅读 · 0 评论 -
【数据结构连载一线性表】【双向链表】python
# -*- coding: UTF-8 -*- """ 线性表之链式存储结构 双向链表 基本操作: 初始化 __init__ 线性表空判断 empty 清空线性表 clear 获取元素 get 是否存在数据 exist 插入操作 insert 删除操作 delete 线性表的长度 length 扩展操作 遍历链表 sh原创 2021-05-08 16:20:47 · 56 阅读 · 0 评论 -
【数据结构连载一线性表】【双向链表】javascript
function Node() { this.data = null; this.next = null; this.pre = null; } function DoubleLinkedList() { this.length = 0; this.head = new Node(); this.tail = this.head; this.empty = function () { return this.tail === this原创 2021-05-08 16:21:39 · 62 阅读 · 0 评论 -
【数据结构连载一线性表】【双向链表】golang
package main import ( "fmt" "strconv" ) type Node struct { data interface{} pre *Node next *Node } type DoubleLinkedList struct { length int head *Node tail *Node } func NewDoubleLinkedList() DoubleLinkedList { node := Node{} l := Double原创 2021-05-08 16:20:13 · 99 阅读 · 1 评论 -
【数据结构连载一线性表】【单向循环链表】python
# -*- coding: UTF-8 -*- """ 线性表之链式存储结构 循环链表 基本操作: 初始化 __init__ 线性表空判断 empty 清空线性表 clear 获取元素 get 是否存在数据 exist 插入操作 insert 删除操作 delete 线性表的长度 length 扩展操作 遍历链表 sh原创 2021-05-07 16:55:03 · 68 阅读 · 0 评论 -
【数据结构连载一线性表】【单向循环链表】golang
package main import ( "fmt" "strconv" ) type Node struct { data interface{} next *Node } type CycleLinkedList struct { length int rear *Node } func NewCycleLinkedList() CycleLinkedList { node := Node{} l := CycleLinkedList{ length: 0, rea原创 2021-05-07 16:54:30 · 92 阅读 · 1 评论 -
【数据结构连载一线性表】【单向循环链表】javascript
function Node() { this.data = null; this.next = null; } function CycleLinkedList() { this.length = 0; this.rear = new Node(); this.rear.next = this.rear; this.empty = function () { return this.rear === this.rear.next };原创 2021-05-07 16:53:53 · 52 阅读 · 0 评论 -
【数据结构连载一线性表】【单链表】javascript
function Node() { this.data = null; this.next = null; } function LinkedList() { this.length = 0; this.head = new Node(); this.tail = this.head; this.empty = function () { return this.length === 0 }; this.exist = fun原创 2021-05-07 16:51:52 · 45 阅读 · 0 评论 -
【数据结构连载一线性表】【单链表】python
# -*- coding: UTF-8 -*- """ 线性表之链式存储结构 基本操作: 初始化 __init__ 线性表空判断 empty 清空线性表 clear 获取元素 get 是否存在数据 exist 插入操作 insert 删除操作 delete 线性表的长度 length 扩展操作 遍历链表 show原创 2021-05-07 16:50:58 · 214 阅读 · 0 评论 -
【数据结构连载一线性表】【单链表】golang
package main import ( "fmt" "strconv" ) type Node struct { data interface{} next *Node } type LinkedList struct { length int head *Node tail *Node } func NewLinkedList() LinkedList { node := Node{} l := LinkedList{ length: 0, head: &原创 2021-05-07 16:50:12 · 51 阅读 · 0 评论 -
【数据结构连载一线性表】【顺序表】golang
package main import "fmt" type List struct { length int Data []interface{} maxSize int } func (l *List) ListInit(size int) { l.maxSize = size l.length = 0 l.Data = make([]interface{}, size) } // Length 顺序表的长度 func (l *List) Length() int { re原创 2021-05-07 16:47:49 · 107 阅读 · 0 评论 -
【数据结构连载一线性表】【顺序表】javascript
function List(maxSize) { this.maxSize = maxSize; this.length = 0; this.data = new Array(maxSize); this.empty = function () { // 顺序表是否为空 return this.length === 0; }; this.full = function () { // 顺序表是否已满原创 2021-05-07 16:46:54 · 58 阅读 · 0 评论 -
【数据结构连载一线性表】【顺序表】python
# -*- coding: UTF-8 -*- """ 线性表之顺序存储结构 python 使用list模拟顺序表 基本操作: 初始化 __init__ 线性表空判断 empty 清空线性表 clear 获取元素 get 是否存在数据 exist 插入操作 insert 删除操作 delete 线性表的长度 length 扩展操作原创 2021-05-07 16:45:12 · 89 阅读 · 0 评论