## Stack and Queue hhh

Stack and Queue
1. Differences
2. Definition of stack
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=100010;
int stk[N],tt;
//insert
stk[++tt]=x;
//Eject
tt--;
//Determine if stack is empty
if(tt>0) not empty
else empty
//Top of Stack
stk[tt ...

Added by **markjia** on *Thu, 10 Mar 2022 19:03:08 +0200*

## [data structure and algorithm] program internal skill Part 4 - stack

1, Principle of stack
Stack is a linear table (commonly known as stack) that is restricted to insert and delete operations at one end
The end at which operations are allowed is called the "top of the stack"
The other fixed end is called "stack bottom"
When there are no elements in the stack, it is c ...

Added by **MNS** on *Thu, 10 Mar 2022 15:07:56 +0200*

## JS algorithm exercise 3.10

Derivation of ring linked list -- the starting point of locating ring
Method 1: record the existing nodes of the flag encountered for the first time
function detectCycle(head) {
while (head) {
if (head.flag) return head;
else {
head.flag = true;
head = head.next;
}
}
return null;
} ...

Added by **Risingstar** on *Thu, 10 Mar 2022 13:35:54 +0200*

## System master data structure 3 linear table C + + implementation

(this article and each subsequent article have such a structure. First, we will talk about the logical structure, then preliminarily understand the physical structure, then realize the code, and finally re understand the advantages and disadvantages of the physical structure in combination with the code. The code of this chapter and the exer ...

Added by **pfoger** on *Thu, 10 Mar 2022 11:11:11 +0200*

## [algorithm and data structure] talk about linear search method~

ðŸ“… preface
As we all know, algorithm and data structure is a necessary course for all computer majors. Algorithm not only reflects a person's logic ability, but also reflects a person's thinking ability. It is not only learning algorithms and data structures, but also a deep understanding of computer science.
In this article, we will star ...

Added by **PunjabHaker** on *Thu, 10 Mar 2022 02:00:12 +0200*

## Data structure -- 8 lookup

8. Find
8.1 introduction to search
A search table is a collection of data elements (or records) of the same type
A key is the value of a data item in a data element, also known as a key value
If this keyword can uniquely identify a record, it is called the primary key
Keywords that can identify multiple data elements (or records) are calle ...

Added by **offnordberg** on *Wed, 09 Mar 2022 14:15:51 +0200*

## python mode, average, median implementation code (including the use of Dictionary)

Instead of numpy, use python to judge the median and average of modes in a list
Title: Statisticians want to use a set of functions to determine the median and mode of a list of numbers. The median is the number that appears in the middle after sorting a list. Mode is the number that appears most frequently in the list. These functions are def ...

Added by **xdentan** on *Wed, 09 Mar 2022 12:18:08 +0200*

## In the solution to the problem of enemy troops' Formation & & c + +, cin is a big pit

In c + +, cin is a big pit. Why do you say that? Let's look at the solution first.
The operation of this problem on the line segment tree is very simple (if you are lazy, you don't write the detailed process...), If you don't know the line segment tree, click the link below (this is equal to this question) Important line segment tree algorithm ...

Added by **gromer** on *Wed, 09 Mar 2022 11:53:19 +0200*

## Sorting algorithm induction

1 Classification of sorting algorithms
1.1 stable sorting vs unstable sorting
Stable sorting: for elements with the same value, the relative positions before and after sequence sorting remain the same, that is, if Ai = Aj, Ai is before Aj, and Ai is still before Aj after sorting. Such as insert sort, bubble sort and merge sort.
Unstable sortin ...

Added by **danharibo** on *Wed, 09 Mar 2022 11:48:18 +0200*

## 2021 ICPC Kunming m stone games (persistent weight segment tree)

2021 ICPC Kunming m stone games (persistent weight segment tree)
At that time, I just looked at it and felt it was a line segment tree, but I couldn't write it. Now let's make up for it
Main idea of the title:
Give you a sequence of 1e6 in length, a (a [i] < = 1e9), and q (q < = 1E5) times. Each time, ask the interval l,r, and ask the ...

Added by **Ghostu** on *Wed, 09 Mar 2022 11:23:44 +0200*