LeetCode.682 baseball game stack (simple)
You are now the recorder of a baseball game with a special game system. This game consists of several rounds. The scores in the past few rounds may affect the scores in the next few rounds.
At the beginning of the game, the record was blank. You will get a string list of recorded operations ops, where ops[i] is the ith operation you need to re ...
Posted on Sat, 04 Dec 2021 22:25:02 -0500 by qartis
Use stack to calculate prefix expression (implement calculator function)
Recently, I learned the stack part of data structure and algorithm, followed the video tutorial of little turtle step by step, wrote code to consolidate some problems, and shared them on the blog. On the one hand, I recorded my learning process, on the other hand, I often check other people's blogs on the Internet to solve problems, and I shoul ...
Posted on Sun, 28 Nov 2021 06:28:52 -0500 by help_needed
Data structure: detailed explanation of queue and stack
Stack
Structure and concept of stack
Stack: a special linear table in which elements are allowed to be inserted and deleted only at the fixed end. The section for data insertion and deletion is called the top of the stack, and the other end is called the bottom of the stack. The elements in the stack follow the principle of first in and l ...
Posted on Fri, 19 Nov 2021 22:11:23 -0500 by rjs
2021-10-29 sword finger offer (queue & stack)
JZ9 implements queues with two stacks
Title address describe Two stacks are used to implement a queue, and n elements are used to complete the functions of inserting integers (push) at the end of the queue n times and deleting integers (pop) at the head of the queue n times. The element in the queue is of type int. Ensure that the operatio ...
Posted on Tue, 02 Nov 2021 11:44:29 -0400 by Alien
[data structure] stack (implementation + original code)
catalogue
Concept and structure of stack
Implementation of stack
Initialization stack
Destroy
Push
Out of stack
Get stack top element
Gets the number of valid elements in the stack
Determine whether the stack is empty
test
Concept and structure of stack
Stack: a special linear table that allows insertion and deletion of elements ...
Posted on Sat, 30 Oct 2021 22:06:36 -0400 by twostars
Evaluation of inverse Polish expression for stack and queue algorithm problems
catalogue
Inverse Polish expression evaluation
describe
explain
Example one
Example two
Example three
Tips
Reverse Polish notation
Method: stack
Method 2: array simulation stack
Inverse Polish expression evaluation
describe
Find the value of the expression according to the inverse Polish representati ...
Posted on Wed, 27 Oct 2021 21:37:31 -0400 by werlop
Stack and queue Basics
1. Definition of stack
A stack is a linear table that can only be inserted and deleted at the end of the table.
We call the end that allows insertion and deletion as the top of the stack, the other end as the bottom of the stack, and the stack without any data elements as an empty stack. Stack is also called last in first out linear tab ...
Posted on Thu, 21 Oct 2021 11:27:56 -0400 by Sillysoft
Leetcode 695. Maximum area of the island
subject
Give you a binary matrix grid of size m x n.
An island is a combination of some adjacent 1s (representing land). The "adjacent" here requires that two 1s must be adjacent in four horizontal or vertical directions. You can assume that the four edges of the grid are surrounded by 0 (representing water).
The area of an island ...
Posted on Wed, 13 Oct 2021 13:19:31 -0400 by $0.05$
leetcode brush Title records day024:20 and 118
20. Easy to use: 45% pass rate
Method 1: Origin: Failed Violence: For my own future review, there are all kinds of situations that I did not think of at first but follow up and corresponding responses
Principle: Normally judge if the current item and the next item are a bunch of parentheses, and add the response of the left parentheses group ...
Posted on Tue, 12 Oct 2021 15:49:40 -0400 by vronsky
c language to realize dynamic compatibilization array stack
1, Overview
Stack is sometimes used in daily development, such as reducing recursive functions to non recursive loops, or parsing xml tags. The c language standard library does not have a stack structure. Here is a stack implementation method, which is based on array implementation and supports dynamic capacity expansion.
2, Principle descrip ...
Posted on Thu, 07 Oct 2021 22:10:02 -0400 by ifuschini