Analysis and code of TopK problem

Problem Description: Find the maximum number of K from arr[1,n] Method 1: heap sorting Sorting algorithm reference: Summary of ten sorting algorithms Idea: Only topk is found, and topk is not sorted. First, use the first k elements to generate a small top heap (that is, a complete binary tree with a parent node smaller than a child node). ...

Added by aopen on Thu, 30 Dec 2021 00:38:22 +0200

Queue of data structure

preface By and by, we have learned the sequence list, single linked list, double linked list and stack Today, what bloggers update is the queue in the data structure 1. What is a queue Queue: a special linear table that only allows inserting data at one end and deleting data at the other end. The queue has the characteristics ...

Added by xymbo on Wed, 29 Dec 2021 18:05:30 +0200

2, Java data structure and algorithm - sorting (explanation and code)

1, Simple sort 1.1 introduction to comparable interface Compare elements, and Java provides an interface. Comparable is used to define sorting rules. Here we briefly review the comparable interface in the form of a case. (remember the customized sorting method corresponding to Comparator) **Demand: * * 1 Define a Student class with age and n ...

Added by ssmK on Wed, 29 Dec 2021 10:27:23 +0200

Common java array usage

1. Assignment Two assignment methods Static initialization: define the contents of the array directly from the beginning Dynamic initialization: open up the space first, and then assign values later. You can not assign all values (at this time, the initial values are not assigned, such as 0 and null) // statement int[] ids; //1.1 s ...

Added by dmort on Wed, 29 Dec 2021 09:38:56 +0200

Flag Engine learning notes - quaternion in the previous chapter of "bone posture"

2021SC@SDUSC In the previous section, we learned about the data structure of bones. Next, we will continue to learn how bones retract, translate and rotate relative to a reference system in the animation system. This is also known as the posture of bones (joints). The pose of the joint is represented by a 4 * 3 or 4 * 4 matrix through the S ...

Added by divinequran on Wed, 29 Dec 2021 08:50:03 +0200

[sword finger offer] minimum number of k

🔥 subject Enter the integer array arr to find the minimum number of k.   ☘️ analysis Solution 1 - simple sorting First of all, you can think of a very simple idea: sort the data from small to large, and take the first k numbers. Analysis: time complexity O(nlogn), that is, sorting overhead. It's not hard to think of a problem. We only ...

Added by agoni on Wed, 29 Dec 2021 08:08:33 +0200

8, Search algorithm

1, Linear search algorithm Linear search algorithm, that is, compare one by one according to the order of the array until the target value is found. For example, there is a sequence: {1,8, 10, 89, 1000, 1234}. Judge whether the sequence contains this name. Requirements: if it is found, prompt to find it and give the following benchmark val ...

Added by mabog on Wed, 29 Dec 2021 07:02:43 +0200

Data structure and algorithm analysis and learning

Learning records: MOOC data structure Huazhong University of science and technology + Data Structure and Algorithms in C++ - etc Day 1 2.2 definition of linear table sequential structure in C language Static allocation: after a fixed size of hardware storage space is allocated to a type variable, if the inserted element exceeds the storage ...

Added by rajavel on Wed, 29 Dec 2021 05:38:38 +0200

Numerical solution of trilinear equations in numerical analysis experiment

1, Purpose and requirements: 1. Familiar with the theory and method of solving linear equations; 2. Be able to prepare column principal component elimination method, LU decomposition method, Jacobian and Gauss Seidel iterative Fard procedures; 3. Through practical calculation, we can further understand the advantages and disadvantages of var ...

Added by arkismad on Wed, 29 Dec 2021 05:09:02 +0200

SVM in machine learning practice

1, Linear SVM 1.1 maximum spacing and classification Find a hyperplane in the sample space to separate different types of samples. At the same time, this line should be as far away from the sample points as possible. Then, this line is in the middle of the two sample points at the edge, and the sample points at these edges are called supp ...

Added by dodgyJim on Wed, 29 Dec 2021 04:56:28 +0200