输入一个链表,按链表从尾到头的顺序返回一个ArrayList。 import java.util.Stack; import java.util.ArrayList; public class Solution { public ArrayList<Integer> printListFromTai ...
分类:
其他好文 时间:
2020-04-01 01:10:22
阅读次数:
68
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov ...
分类:
其他好文 时间:
2020-03-31 22:46:01
阅读次数:
62
import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self.items.append( ...
分类:
其他好文 时间:
2020-03-31 14:10:56
阅读次数:
49
import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self.items.append( ...
分类:
编程语言 时间:
2020-03-31 12:42:32
阅读次数:
72
二叉树中序非递归 从root开始,一直往左孩子走入栈,走到头 倒退回去到有右孩子的点重复上一个步骤,注意,这中间经过的栈扔出去的点,包括最后一个有右孩子的点都要存到ans里面 注意判断stack为空 /** * Definition for a binary tree node. * struct ...
分类:
其他好文 时间:
2020-03-31 12:21:52
阅读次数:
55
1.进程是资源分配单位, 线程是CPU调度单位 2.进程拥有一个完整的资源平台, 而线程只独享指令流执行的必要资源,如registers和stack 3.线程具有 就绪, 阻塞, 运行 三种基本状态和状态间的转换关系 4. 线程能减少并发执行的时间空间开销 多线程的引入: 在进程内部增加一类实体满足 ...
分类:
编程语言 时间:
2020-03-31 12:19:31
阅读次数:
73
先做个热身 //递归:函数执行的时候自己调用自己 // function fn(){ // fn(); //Uncaught RangeError: Maximum call stack size exceeded // 这种死递归会导致栈溢出 // } // fn(); // function f ...
分类:
编程语言 时间:
2020-03-31 12:16:24
阅读次数:
77
import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self.items.append( ...
分类:
其他好文 时间:
2020-03-31 10:23:45
阅读次数:
120
import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self.items.append( ...
分类:
编程语言 时间:
2020-03-30 21:46:18
阅读次数:
79
1、集合输出在之前我们利用了toString()及get()方法对集合进行了输出,其实那都不是集合的标准输出,集合输出有四种方式:Iterator、ListIterator、Enumeration、foreach。(1)Iterator(迭代输出)在jdk1.5之前,在Collection接口中就有 ...
分类:
其他好文 时间:
2020-03-30 21:22:06
阅读次数:
77