Algorithms and data structures
Algorithm is the soul of the program, an excellent program can still maintain high-speed computation in massive data relying on excellent algorithms, generally we use memory computing framework such as (Spark), or use caching technology such as Redis to optimize our program, then what is their core?
There is no doubt that it is an algorithm, but what is the relationship between algorithms and data structures?
1.Data structures are the study of how data is organized, and with programming languages comes data structures, which can make our code more efficient.
2.Data structure is the basis of algorithm, the premise of learning algorithm is to master data structure.
Friendly note: So students should first look at the data structure before learning the algorithm
Project Overview:
The repository is a collection of open source implementations of various algorithms implemented in C++ and licensed under the MIT license. These algorithms cover topics as diverse as computer science, mathematics and statistics, data science, machine learning, and more.
Example algorithm:
Backtracking algorithm: The backtracking algorithm is actually a search attempt process similar to enumeration, mainly in the search attempt to find a solution to the problem, when it is found that the solution conditions are not met, it is “backtracking” back to try another path. Backtracking is a kind of optimal search method, which searches forward according to optimal conditions to reach the goal.
y
Cryptography: including Base64 encoding, Hill cipher, Morse code, XOR cipher, etc.
Divide-and-conquer algorithm: The basic idea of divide-and-conquer algorithm is to decompose a problem of size N into K smaller subproblems, which are independent of each other and have the same properties as the original problem. Such as the Karatsuba algorithm for fast multiplication.
Dynamic programming: The process of dynamic programming is that each decision depends on the current state and then causes the state to shift. A decision sequence is produced in the changing state, so this multi-stage optimal decision solving process is called dynamic programming. The biggest difference with the divide-and-conquer method is that it is suitable for solving problems with dynamic programming method, and the subproblems obtained after decomposition are often not independent of each other (that is, the solution of the next substage is based on the solution of the previous substage for further solution), such as Freud’s algorithm, matrix, etc.
Geometry: Geometric algorithms often appear in computer graphics, large-scale integrated circuit design, etc., often need to analyze the relationship between points, line segments and straight lines in the plane, and most of its algorithms use the idea of induction, divide and conquer algorithms.
Graphics: including breadth-first search, Dijkstra algorithm, topological sorting, traveling salesman problem, etc.
Greedy algorithm: (also known as greedy algorithm) means that when solving a problem, always make the best choice in the current situation. That is to say, the algorithm gets a local optimal solution in a certain sense without considering the overall optimal. Hoffman, Dijkstra, the backpack problem.
Search algorithms: such as binary search, hash search, linear search, ternary search, etc.
Sorting algorithms: such as bubble sort, bucket sort, heap sort, merge sort, quick sort, swing sort and so on.
Features:
- The repository provides implementations of various algorithms in one of the most basic general-purpose languages – C++.
- The well-documented source code with detailed explanations provides an invaluable resource for educators and students.
- Each source code is made use of atomic STL classes and no external libraries are required for their compilation and execution. Therefore, you can delve into the basics of the algorithm.
- Strict adherence to the C++11 standard ensures that the code is portable to embedded systems as well as ESP32, ARM Cortex, etc., with little change.
- Modular implementation and open source licensing make these features readily available in other applications.
Document: Click to download
The document describes in detail the source code of various algorithms, including source code fragments, program execution flow, links to external resources, etc. The document also introduces the interactive source code, including links to the C++STL library function documentation.