iOS data structure and algorithm
iOS data structure and algorithm
1, Data structure
1. Set structure: an unordered and non repetitive element structure, which can be regarded as a special array (no order, and the data elements are not repeated) 2. Linear structure: a. There must be a unique first element in the set; b. There must be a unique last element in the set c. Exce ...
Added by unreal128 on Wed, 26 Jan 2022 07:15:25 +0200
Interpolation search algorithm
Interpolation search algorithm
Interpolation search algorithm, also known as interpolation search algorithm, is a search algorithm improved on the basis of binary search algorithm.
The interpolation search algorithm is only applicable to ordered sequences. In other words, it can only find the target elements in ascending or descending sequenc ...
Added by zampu on Wed, 26 Jan 2022 04:30:42 +0200
Floating point cardinality sort
Floating point cardinality sort
During this time, when studying the external sorting of massive floating-point numbers, I studied some algorithms of internal sorting, and never thought about cardinality sorting. I happened to see it these two days RadixSortRevisited This article, deeply touched, wants to try to reproduce the cardinality sortin ...
Added by Chesso on Wed, 26 Jan 2022 03:47:13 +0200
week10_task_ Joint search set diagram
10, Joint search set
source
Geek time 2021 algorithm training camp
Author: Li Yudong
1. Merge query set
Join query set is a tree data structure, which is used to deal with the merging and query of some disjoint sets. The idea of parallel search set is to use an array to represent the whole forest (parent). The root node of t ...
Added by big_al on Wed, 26 Jan 2022 03:42:41 +0200
Atcoder beginer contest 236 ABC code style format #ifdef#else#endif ios::sync_with_stdio tie XOR map container vector container
Eight minutes a, the first two, and then the third, the head card fell off. (record the tragic experience. Just keep grinding the problem.
I found this when thinking about the solution:
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
Learn the form:
#ifdef identifier
Segment 1
#else
Segment 2
#endif
It means: w ...
Added by elie on Tue, 25 Jan 2022 22:07:13 +0200
0019 - delete the penultimate node of the linked list
Problem description
Give you a linked list, delete the penultimate node of the linked list, and return the head node of the linked list. Advanced: can you try using one scan?
Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Example 2: Input: head = [1], n = 1 Output: [] Example 3: Input: head = [1,2], n = 1 Output: [1] ...
Added by Namadoor on Tue, 25 Jan 2022 21:03:40 +0200
Using Huffman coding to compress the string
Basic introduction
Huffman coding, also known as optimal coding, is a coding method and also belongs to a program algorithm.Huffman coding is one of the classical applications of Huffman tree in telecommunications.Huffman coding is widely used in data file compression, and its compression rate is usually between 20% ~ 90%.Huffman coding is ...
Added by Protato on Tue, 25 Jan 2022 19:51:02 +0200
LeetCode Day5 [data structure] intersection 2 of two arrays, best opportunity for trading stocks
350 Intersection of Two Arrays II intersection of two arrays 2
subject
attempt
First attempt:
class Solution {
public int[] intersect(int[] nums1, int[] nums2) {
Arrays.sort(nums1);
Arrays.sort(nums2);
int[] nums3 = new int[nums1.length + nums2.length];
int size = 0;
for( int i = 0; i < num ...
Added by phice on Tue, 25 Jan 2022 18:41:44 +0200
Cache system invalidation algorithm and its application
1 first come first out (FIFO)
Invalidation algorithms are common in cache systems. Because the cache often occupies a large amount of memory, and the memory space is relatively expensive and the space is limited, some values should be invalidated or removed according to the corresponding algorithm.
1.1 general
First In First Out. This ...
Added by astribuncio on Tue, 25 Jan 2022 17:40:21 +0200
GNN learning notes: graph feature learning method based on graph neural network
In this article, we will learn the graph feature learning method based on graph neural network. Graph feature learning requires generating a vector as the representation of the graph according to the node attributes, edges and edge attributes (if any). Based on graph representation, we can predict the graph.
The graph representation network ba ...
Added by blakey on Tue, 25 Jan 2022 17:21:51 +0200