Tag：Stack top

Sword finger offer plan 1 (stack and queue) — Java
1.1 topic 1 Sword finger offer 09 Queue with two stacks 1.2 solution The solution is as the title says. Define two stacks. Here, assume that the first stack is a and the second stack is B. Implement two functions to add tail and delete header. Add, that is, push directly into the first stack. […]

Stack of data structure: only one article for beginners
catalog: What is a stack? What are the characteristics of stack? How to implement stack? (static stack, dynamic stack) Stack specific application? Text: What is a stack? Stack, also known as stack, is a linear table with limited operation. Limit linear tables to insert and delete only at the end of the table. This end […]

Leetcode topic summary
A number that appears only once Use XOR, because two identical XORs result in 0. XOR in Java:^ Circular linked list Use the fast and slow pointer, because if there is a ring, the fast pointer will catch up with the slow pointer public boolean hasCycle(ListNode head) { if (head == null  head.next […]

Go data structure ice breaking road – (II) love and hate of stack
Stack definition //A type of linear table whose structure is open at one end and closed at the other //The open end, which allows insertion and deletion, is called the top of the stack //The closed end becomes the bottom of the stack //Write out the construction structure of the stack according to the definition […]

2. Data structure (implemented in PHP) — stack with array
Note: This article uses array to realize stack, so it will mainly do logical operation on array (the logical operation of array is mentioned above)https://segmentfault.com/a/11…） 1. Implementation logic <?php /** *Content: implementation of array stack * create: 20201020 */ namespace StackBundle; use ArrayBundleBaseArray; class BaseArrayStack { /** *Array class * @var BaseArray */ protected $baseArray; […]

Data structure – sequential storage structure of linear table – stack
Create an auto shrinking stack with an array Description: stack, which is a linear table with limited operation. Limit linear tables to insert and delete only at the end of the table. This end is called the top of the stack, and the other end is called the bottom of the stack. Inserting a new […]

Minimum stack problem [leetcode algorithm 155]
Problem Description: A data structure is designed to store numbers. The range of stored values is [ 100000, 100000]. It supports push, pop and top operations, and can retrieve the stack of the smallest element in a constant time. Push (x) — push element x onto the stack.Pop () — delete the element at the […]

4.3 data structure (PHP Implementation) — traversal of binary search tree (non recursive implementation)
Based on the extension of chapter 4.2, the pre order traversal, middle order traversal and post order traversal are realized in a non recursive way 1. Binary search tree (this chapter is based on the binary search tree as an example) 2. Code (non recursive traversal of binary tree is realized in traversalbystack method) /** […]

Array simulation (I)
Write in front The focus of recent study should be on graph theory. The data structures that I have been learning in acwing are array simulation. The efficiency of array simulation is several times faster than that of STL. I will forget it soon after learning, but forgetting is also a kind of learning. It […]

Stack and queue (including monotone stack and monotone queue)
Stack Algorithm idea Stack（\(stack\)）Also known as stack, it is a linear table with limited operation. Limit linear tables to insert and delete only at the end of the table. This end is called the top of the stack, and the other end is called the bottom of the stack. Inserting a new element into a […]

Java data structure and algorithm analysis  stack
GitHub source code sharing Project home page:https://github.com/gozhuyinglong/blogdemosSource code of this article:https://github.com/gozhuyinglong/blogdemos/tree/main/javadatastructures 1. Stack Stack, also known as stack, is a linear table with restricted operations. It is limited that insertion and deletion operations can only be performed at one end, which is called the top of the stack, and the opposite end is called the […]

Stack
Stack Basic concepts Logical structure definition Stack(stack): only allowed inone endTo insert or deleteLinear table。 Stack top(top): the end of a linear table that allows insertion and deletion. Stack bottomBottom: fixed end that cannot be inserted or deleted. Empty stack: an empty table without any elements. characteristic Last in first out（Last In First Out,LIFO) N […]