Tag:Stack top

  • Sword finger offer plan 1 (stack and queue) — Java

    Time:2022-4-14

    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

    Time:2022-4-11

    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

    Time:2022-3-22

    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

    Time:2022-2-16

    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

    Time:2022-2-11

    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: 2020-10-20 */ namespace StackBundle; use ArrayBundleBaseArray; class BaseArrayStack { /** *Array class * @var BaseArray */ protected $baseArray; […]

  • Data structure – sequential storage structure of linear table – stack

    Time:2022-2-2

    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]

    Time:2022-1-28

    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)

    Time:2022-1-28

    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)

    Time:2022-1-26

    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)

    Time:2022-1-18

    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

    Time:2022-1-3

    GitHub source code sharing Project home page:https://github.com/gozhuyinglong/blog-demosSource code of this article:https://github.com/gozhuyinglong/blog-demos/tree/main/java-data-structures 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

    Time:2021-12-30

    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 […]