Should C + + return an object or a pointer to the object when brushing questions?
This paper only discusses whether to return the object or the pointer of the object when writing algorithm problems in C + +.
As we all know, C + + variables are different from java and python. C + + variables are not natural pointers, so the assignment between object type variables is much more time-consuming than java and python. For example ...
Posted by AnnieKay on Mon, 20 Sep 2021 23:04:34 -0700
[sword finger Offer] search and backtracking
Li Kou's notes have been opened to the public: Portal [Author: ArtBoy literature and art
Self-Improvement
There's no better way to overpower a trickle of doubt than with a flood of naked truth. A flood of facts is the best way to break a trace of doubt.
Title Source: https://leetcode-cn.com/leetbook/detail/illustration-of-algorith ...
Posted by garmann on Mon, 20 Sep 2021 22:42:42 -0700
✨✨✨ [C language] take you to brush questions in the shortest time (with problem-solving ideas and specific codes) and constantly update them ✨✨✨
🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷
🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷🐷
💚 BC41. Are you a genius
Description:
It is said that people with an IQ above 140 are called geniuses, KiKi If you want to know if he is a genius, please help him judge by programming. Enter an integer to indicate a person's IQ. If it is gre ...
Posted by Garcia on Mon, 20 Sep 2021 21:16:22 -0700
Several semaphore mechanism algorithms
Producer-consumer questions:
_is too classic to be repeated.
import java.util.concurrent.Semaphore;
public class ProducerAndConsumer {
static int count = 0;
private static final Semaphore full = new Semaphore(0);
private static final Semaphore empty = new Semaphore(20);
private static final Semaphore mutex = new Semaphore(1);
publi ...
Posted by dannon on Mon, 20 Sep 2021 20:50:47 -0700
[graph theory] thinking and Analysis on the difference between Dijkstra algorithm and Spfa algorithm
1, Foreword
Dijkstra algorithm and Spfa algorithm are commonly used in the shortest path problem. However, if we learn these two algorithms, we can find that the priority queue optimization of Dijkstra algorithm is very similar to the code of Spfa algorithm. If we do not deeply understand the principles and differences of the two algorithm ...
Posted by BSkopnik on Mon, 20 Sep 2021 18:43:04 -0700
Data structure and algorithm -- linked list
catalogue
1, Single linked list
1.1 basic introduction
1.2 schematic diagram of single linked list logic structure
1.3 adding and deleting data in single linked list (sorted by data number)
one point four Find the penultimate node in the single lin k ed list
1.5 reverse single chain table
one point six Disadvantages of sing ...
Posted by azaidi on Mon, 20 Sep 2021 14:08:44 -0700
Single linked list partial pseudo code
Pseudo code of linked list
1. A recursive algorithm is designed to delete all the nodes with the value of x in the single linked list L without the leading node
Writing thought;
1)Establish recursive function and judge each round L->data Is it x,If yes, delete the node, and then L = L->next,Until the end of the linked list is travers ...
Posted by clang on Mon, 20 Sep 2021 10:01:31 -0700
Binary search summary
Binary search
Brush LC for the first time, make a little summary, a little excited
0. Basic
1. When calculating the mid index, you should
int mid = left + (right-left)/2;
instead of
int mid = (left+right)/2;
Can prevent left+right overflow (out of integer range)
2. If it is not bisection, it must be recursive like sorting For simple ...
Posted by kristalys on Mon, 20 Sep 2021 09:22:11 -0700
Simple date format conversion and expression evaluation
preface
These are the last two questions I did in Chapter 9 of c++primer, and their difficulty is also the most difficult question I have encountered so far in this book. I don't have a good idea about the first question, so I read the reference answer directly. For the second question, the reference answer is only about addition and subtracti ...
Posted by steeveherris on Mon, 20 Sep 2021 09:17:44 -0700
Research on fast algorithm of factorial
solve the problem
Find a factorial
n
!
m
o
d
P
n! \ mod P
n! modP.
executive summary
In this paper, a fast factorial ...
Posted by yapyapayap on Mon, 20 Sep 2021 08:27:33 -0700