Top ten classic sorting: merge sorting | bucket sorting
Merge sort
Merge sort principle
What is merge sort? To merge and sort, we must first understand what is merging: merging two ordered sequences into one ordered sequence, which we call "merging".
Idea: merge sort is to sort the sequence of numbers by using the idea of merge. According to the specific implementation, merge sortin ...
Posted by dlcmpls on Sun, 28 Nov 2021 03:08:06 -0800
4014 - solution of simple path with length k based on adjacency table (C + +, with ideas)
describe
A connected graph uses adjacency table as storage structure. An algorithm is designed to judge whether there is a simple path with length k at any given two points in an undirected graph.
input
Multiple groups of data, each group of m+3 data rows. The first line has two numbers n, m and k, representing n vertices, m edges and length ...
Posted by vitorjamil on Sat, 27 Nov 2021 23:32:48 -0800
What is Huffman tree
Write in front
The linked list, stack and queue mentioned earlier are linear storage structures, which are one-to-one relationships. Tree is a data structure with one to many relationship. For example, we often say that a class diagram in Wuhan, Hubei Province and Changsha, Hunan Province is similar to an inverted tree.
What is a tree
Tree is ...
Posted by trevorturtle on Sat, 27 Nov 2021 20:48:09 -0800
Statistical leaf node 21
1, Title Description
Description
The preorder traversal and inorder traversal of a binary tree are given, and the number of leaf nodes of the corresponding binary tree is counted. This question requires the use of a binary linked list, otherwise even if it passes, points will be deducted as appropriate.
Input
Input two lines of string compo ...
Posted by freelancedeve on Sat, 27 Nov 2021 18:56:45 -0800
[data structure] recursive implementation of quick sorting_ Detailed explanation of three methods + optimization
There are eight common sorting algorithms, so it is estimated that they will be divided into several periods. Interested friends may wish to click a collection column. ღ (´ᴗᴗღ) comparison Center
OJ link
Quick sort is an exchange sort method with binary tree structure proposed by Hoare in 1962. Its basic idea is:
Any element in t ...
Posted by Brad on Sat, 27 Nov 2021 17:21:23 -0800
Tencent two-sided algorithm problem: circle of friends problem
Hello, I'm a senior programmer~
Today, let's share a Tencent two-sided algorithm problem, basin friend circle problem~
If you like, remember to pay attention~
Circle of friends problem
There are now 105 users numbered 1 - 105. It is known that there are m pairs of relationships. Each pair of relationships gives you two numbers x and y, represen ...
Posted by oni-kun on Fri, 26 Nov 2021 19:52:50 -0800
Single linked table 1 (data structure)
Single linked list
1. Definition of linked list
Chain storage structure of linear table: the location of data elements (nodes) in linear table in memory is arbitrary, that is, logically adjacent data elements are not necessarily adjacent in physical location.
Related terms:
Nodes: storage images of data elements. It consists of data ...
Posted by kansaschuck on Fri, 26 Nov 2021 18:40:14 -0800
Concept and implementation of data structure heap
preface:
It seems that we did talk about heap in C language teaching before, but it is the heap in the operating system. The heap we are going to talk about today is the heap in the data structure. There are also stacks and heaps in the data structure, which has nothing to do with the stack and heap in the memory division of the operati ...
Posted by Bind on Fri, 26 Nov 2021 16:26:13 -0800
Request page storage management basic replacement algorithm LRU and CLOCK
1, Experimental purpose
By simulating several basic page replacement algorithms for request page storage management, understand the characteristics of virtual storage technology, master the basic ideas and implementation process of several basic page replacement algorithms in virtual storage request page storage management, and compare their e ...
Posted by fortnox007 on Fri, 26 Nov 2021 16:03:13 -0800
Java - collection framework and data structure behind it
Objectives of this section
Understand what a collection framework isUnderstand the meaning of learning set frameworkMaster the relevant interfaces and common implementation classes of the collection frameworkUnderstand what to learn in the next stage
1. Introduction
Official course The Java Collection Framework, also known as the container c ...
Posted by dig412 on Thu, 25 Nov 2021 22:10:36 -0800