Sorting algorithm Counting Sort
Summary
Bubble, Select, Insert, Merge, Fast, Hill, Heap Sort, are all sort based on comparison
The lowest average complexity is O(nlog(n)) Count, bucket, cardinality sort, not comparison-based sort
Is a typical space-exchange time, and in some cases, the average time complexity can be lower than O(nlog(n))
Core Ideas
Count the n ...
Posted by su1d on Thu, 30 Dec 2021 21:35:20 +0100
Java 8 uses Stream stream to operate List
Java 8 uses Stream stream to operate List
create object
//user object
public class UserPO {
@ApiModelProperty(example = "", required = false, value = "Serial number")
private Integer id;
@ApiModelProperty(example = "", required = false, value = "full name")
private String name;
@ApiModelProperty(example = "", required ...
Posted by superwormy on Thu, 30 Dec 2021 18:21:19 +0100
[data structure and algorithm] LeetCode single linked list exercise
Reverse linked list
Title link here
Three pointers:
Problem solving ideas:
First analyze the special case. When the linked list is empty or there is only one node, directly return to head When there are more than one node in the linked list, we first consider whether we can reverse the pointer in turn, so as to reverse the linked list ...
Posted by quetz67 on Thu, 30 Dec 2021 11:13:37 +0100
Partial sword finger offer
Data structure and algorithm
sort
Merge sort (divide and conquer algorithm)
The idea is to recursively split the array, compare and replace it, and then merge it
Code implementation:
package com.xu.fingeroffer.recursion;
import java.util.Arrays;
public class Merge sort {
public static void main(String[] args) {
int a[] = {9, ...
Posted by DangerousDave86 on Thu, 30 Dec 2021 07:45:33 +0100
Hand tearing ring queue Series II: lock free to achieve high concurrency
This article is the second in the series of hand tearing ring queue. The links to previous articles are as follows:Hand tearing ring queue
The previous article introduces a basic ring queue, which can be used in multithreading, but there is one premise:At any time, there can only be one producer and one consumer.
In other words, if multiple p ...
Posted by audiodef on Thu, 30 Dec 2021 05:38:46 +0100
[hash series] my roommate was worried that I couldn't sleep in the final exam. I prepared this set of hash topics all night
⭐ Introduction ⭐ ️ Hello, I'm Zhijie. Today we will bring you a set of special training questions for hash questions. Hash table plays a very important role in data structure. Many students always learn theoretical knowledge and lack practical use. The so-called generals are all killed from the battlefield. If you want to become the great God ...
Posted by phazorRise on Thu, 30 Dec 2021 05:00:23 +0100
Sequence table of data structure
Linear table
A linear list is a finite sequence of n data elements with the same characteristics. Linear table is a data structure widely used in practice. Common linear tables: sequential table, linked list, stack, queue, stringA linear table is logically a linear structure, that is, a continuous straight line. But in physical structure I ...
Posted by adv on Thu, 30 Dec 2021 04:35:16 +0100
Learning notes to write simple and orderly linked list creation and query modification
Task description
Write a simple one-way linked list to manage a group of ordered integers with variable length (query, insert, modify and delete).
Programming requirements
(1) Create a one-way linked list, whose node contains two integer data fields: number and xuhao (the serial number increases from 1, and the serial numbers of two ...
Posted by amethyst42 on Thu, 30 Dec 2021 01:38:35 +0100
Chapter 5 #5.2 graph traversal and Application
Graph traversal: starting from a vertex of a connected graph, access and traverse all vertices in the graph along some edges, and each vertex is accessed only once. This is called graph traversal, which is the basic operation of the graph
Traversal essence: the process of finding the adjacency point of each vertex
Characteristics of graph: ...
Posted by praveenhotha on Wed, 29 Dec 2021 21:51:23 +0100
[data structure] stack / queue / sorting algorithm
What is a linear table for?
(sequential list and linked list) linear storage data
Stack concept: implemented with linear table - last in first out - LIFO last in first out
Stack (also known as stack): a container that can store data elements for access and deletion Single end operation: it is only allowed to add (push) and output (pop) data ...
Posted by kender on Wed, 29 Dec 2021 20:12:09 +0100