![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
栈
数据结构---栈
辛勤的搬砖者
这个作者很懒,什么都没留下…
展开
-
【数据结构连载一栈】【四则运算--后缀表达式】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 · 267 阅读 · 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 · 172 阅读 · 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 · 276 阅读 · 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 · 108 阅读 · 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 · 84 阅读 · 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 · 115 阅读 · 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 · 70 阅读 · 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 · 65 阅读 · 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 · 80 阅读 · 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 · 69 阅读 · 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 · 110 阅读 · 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 · 92 阅读 · 0 评论