Introduction to stack (c language implementation)

preface When you use the browser to surf the Internet, almost all browsers have a back button. After you click it, you can return to the previously loaded web pages in reverse order of access order. There are many similar operations in life. Using word undo, their principle is a data structure we will introduce next - stack. 1, What is a ...

Posted by jimmyo on Tue, 08 Mar 2022 22:24:00 +0100

Linear table - 04 stack

Write before: Today, let's learn about the stack structure. The stack can also be called directly in C + + STL, but we can use C + + to realize the stack structure. Definition of stack The stack meets the principle of "first in and last out", that is, it can only be inserted and deleted from the tail. The implementation of the sta ...

Posted by rReLmy on Tue, 01 Mar 2022 12:12:51 +0100

Data structure overview 2 stack and queue

catalogue Stack definition Sequential storage structure (static allocation) Five operations in which top is an integer (when top points to the next position of the top element of the stack) Five operations in which top is an integer (when top points to the top element of the stack) Sequential storage structure (dynamic allocation) Five o ...

Posted by jonniejoejonson on Sun, 20 Feb 2022 13:47:15 +0100

Solution to 2021 TIANTI competition

2021 program design TIANTI competition was held on April 24. This article is part of the solution of TIANTI competition. Some problems did not get full marks at that time. Because the school opened the reproduction competition of TIANTI competition, write again. Note: the answer in this article is not the standard answer. The score of each que ...

Posted by devans on Sat, 19 Feb 2022 00:34:08 +0100

Sword finger Offer: [day 1 stack and queue (simple)] --- > stack containing min function

1, Title Description To define the data structure of the stack, please implement a min function that can get the smallest element of the stack in this type. In this stack, the time complexity of calling min, push and pop is all. O ( 1 ...

Posted by steelerman99 on Tue, 15 Feb 2022 14:00:23 +0100

Introduction to prefix, infix and suffix expressions (implemented by computer code)

1. Prefix, infix, suffix expression 1.1 prefix expression (Polish expression) Prefix expression is also called polish. The operator of prefix expression is before the operand, Examples: (3 + 4) × The prefix expression corresponding to 5-6 is [- x+3456] Computer evaluation of prefix expressions Scan the expression from right to ...

Posted by Youko on Tue, 15 Feb 2022 06:05:16 +0100

[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "maximum Rectangle"

1, Title Requirements Given a two-dimensional binary matrix containing only 0 and 1 and the size of rows x cols, find the largest rectangle containing only 1 and return its area.Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]] Output: 6 Example 2: Input: matrix = [] Outp ...

Posted by solarisuser on Fri, 11 Feb 2022 15:49:53 +0100

Implementation and application of [data structure] stack Python code example

  catalogue The stack is implemented as follows: Several practical applications of stack The stack is implemented as follows: Method 1: take the tail of the list as the top of the stack, and use the list method append and pop to realize the stack class Stack: def __init__(self): #Initialization class self.items=[] def isE ...

Posted by broann on Thu, 10 Feb 2022 12:27:32 +0100

Recursion (with examples)

1. What is recursion A function call itself is recursive. Recursion usually transforms a large and complex problem into subproblems layer by layer until the subproblem can be solved without further recursion. Recursion greatly reduces the amount of code. Generally speaking, a recursive algorithm consists of the following parts: A termination ...

Posted by zplits on Mon, 07 Feb 2022 21:03:07 +0100

Easy use of stack and implementation of stack by hand

Concept and characteristics of stack Stack is a special linear table, which only allows the insertion and deletion of elements at the fixed end. One end for data insertion and deletion is called the top of the stack, and the other end is called the bottom of the stack. The data elements in the stack follow the principle of Last In First Ou ...

Posted by 2levelsabove on Sun, 30 Jan 2022 17:26:23 +0100