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

Solution of the 10th Blue Bridge Cup group B provincial competition of C / C + +

A. Team up Answer: 490 This question is very simple. You can calculate it directly by hand, find the highest score in each column, and do not repeat it. If there is repetition, you can choose the next highest score B year string [problem description] Xiao Ming uses the letter A to correspond to the number 1, B to correspond to 2, and ...

Added by chopper_pc on Thu, 10 Mar 2022 14:05:39 +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

Sword finger offer Second Edition

Sword finger offer Second Edition 1. Duplicate numbers in the array (Offer-03) Use both sets and dictionaries. var findRepeatNumber = function(nums) { let map = new Set() for(let i = 0; i < nums.length; i++) { const n = nums[i] if(map.has(n)) { return n } map.add(n) } }; 2. Search ...

Added by ravegti on Thu, 10 Mar 2022 11:03:54 +0200

Summary of leetcode problem solving methods

1. Sliding window method Example: 209. Minimum length subarray (find the smallest array satisfying > = target) Idea: use two pointers (similar to fast and slow pointers). If you are not satisfied, move the r pointer to the right until you are satisfied. If you are satisfied, move the l pointer to the left until you are not satisfied. Meth ...

Added by erasam on Thu, 10 Mar 2022 10:28:18 +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

Blue Bridge Cup Training March 8

Pure prime number Title link: https://www.lanqiao.cn/problems/1561/learning/ Create an array to record whether each bit is a prime number or not Traversing through each number, if it is a prime number, then all the numbers that are multiple of its integer are not prime numbers, set the filter directly in the array, and then judge if ...

Added by greens85 on Wed, 09 Mar 2022 19:02:44 +0200

Blue Bridge Cup 31 day sprint punch in (Day3)

First question Age coincidence Xiao Ming went to the cinema with his cousin. Someone asked their age. Xiao Ming said: this year is our lucky year. The four digits of my year of birth add up to my age. So is my cousin's. It is known that this year is 2014, and Xiao Ming's age refers to one year old. Please infer and fill in Xiao Ming's year o ...

Added by foxfirediego on Wed, 09 Mar 2022 17:54:38 +0200

The 11th Blue Bridge Cup provincial Simulation Competition - Changcao

The 11th Blue Bridge Cup provincial Simulation Competition - Changcao Title Description Xiao Ming has an open space, which he divides into n n n line m m The length of each row and c ...

Added by mikeylikesyou on Wed, 09 Mar 2022 17:42:11 +0200