Algorithm: double pointer

Double pointer Double pointer is an idea or a skill, not a specific algorithm. Specifically, we use two variables to dynamically store two nodes to facilitate some operations. Usually used in linear data structures. Especially for the problems of linked list, it is often necessary to use two or more pointers to memorize the nodes on the linke ...

Added by Gordonator on Sat, 05 Mar 2022 12:39:02 +0200

bubbleSort

Algorithm idea: Starting from the first element, compare the values of two adjacent elements in pairs, and put the larger one behind (from small to large) Average time complexity: O(n2) Worst time complexity: O(n2) Optimal time complexity: O(n) Space complexity: 1 Stability: unstable Suitable for scene: few elements Code implementation: Mode 1 ...

Added by blacksnday on Sat, 05 Mar 2022 10:59:02 +0200

Accurate values of arithmetic, factorial, twin prime numbers, 6174 problems for pupils

Preface 🍀 Today, I'll share with you some of the algorithmic problems I brushed up about numerical processing. Although the topic is relatively simple, the way in which the problem is handled is worth learning. Pupil arithmetic involves addition carry, factorial exact values used to calculate a number that results in a very long time, ...

Added by ShaKeD on Sat, 05 Mar 2022 09:56:35 +0200

Heap of data structure (priority queue) c++

Heap of data structure (priority queue) c++ What is a pile? Heap (priority queue) is a "special" queue. The order in which elements are taken out is based on the priority (keyword) size of elements, not the order in which elements enter the queue. The heap can be regarded as a complete binary tree. You can use either a linked list o ...

Added by journy101 on Sat, 05 Mar 2022 08:19:16 +0200

The principle of pre order, middle order, post order and hierarchical traversal of binary tree and its C + + code implementation

Binary tree is the simplest tree structure, which is usually composed of root node, left subtree and right subtree. The common binary tree consists of balanced binary tree, binary search tree and so on. Next, the author will focus on the principle and code implementation of pre order, middle order, post order and hierarchical traversal of ordin ...

Added by crondeau on Sat, 05 Mar 2022 08:02:02 +0200

[task allocation] UAV task allocation based on ant colony algorithm with matlab code

1 Introduction With the rapid development of intelligent technology and robot system, multi robot system is used more and more widely. The multi task assignment problem of swarm robots is an important research field of multi robot systems. The task assignment problem is a typical combinatorial optimization problem. The research on optimal task ...

Added by Tonka1979 on Sat, 05 Mar 2022 07:53:32 +0200

[classes and objects] initialization list, friends, static members, internal classes

Hello, bald men. Today, let's continue to talk about classes and objects Key points of this chapter Initialization listFriendsstatic memberInner classUnderstand encapsulation again Let's talk about constructors After studying the first two chapters [classes and objects], let's take a look at the structure Constructor body assignment ...

Added by incubi on Sat, 05 Mar 2022 07:32:39 +0200

[TSP problem] solve the three-dimensional traveling salesman problem based on genetic algorithm, including Matlab source code

1 Introduction 1.1 TSP introduction "Traveling salesman problem" (TSP) can be simply described as: a seller starts from one of the n cities, does not repeatedly complete the other n-1 cities and returns to the original starting point, and finds the shortest path among all possible paths. The route of a traveler can be regarded as a ...

Added by saeed42 on Sat, 05 Mar 2022 07:31:48 +0200

Calculation of geospatial distance from GPS data

Reference link https://en.wikipedia.org/wiki/Haversine_formula https://en.wikipedia.org/wiki/Great-circle_distance https://blog.csdn.net/u011001084/article/details/52980834 https://www.cnblogs.com/softfair/p/lat_lon_distance_bearing_new_lat_lon.html https://blog.csdn.net/weixin_33895604/article/details/93930991 https://www.cnblogs.com/osn ...

Added by fxpepper on Sat, 05 Mar 2022 07:08:10 +0200

227-C + + dynamic programming

1. Dynamic planning The dynamic programming algorithm is similar to the divide and conquer method. Its basic idea is to decompose the problem to be solved into several sub problems. First solve the sub problems, and then get the solution of the original problem from the solutions of these sub problems. Different from the divide and conquer met ...

Added by The_Walrus on Sat, 05 Mar 2022 05:13:10 +0200