According to the flow of \ (kruskal \) algorithm, the relationship of edge weight in the minimum / large spanning tree is mapped to a binary tree
The specific implementation is also very simple
In the original \ (kruskal \) algorithm, each time two points not in the same set are found, a new node is opened
Then connect the ancestor node ...
Posted by dink87522 on Thu, 28 Apr 2022 01:00:33 +0300
The solution of this problem is rich and colorful!
The line segment tree approach is excellent
Very little code
The idea of maintaining a \ + 1 line segment is obvious
How can we maintain the space without exploding?
We found that although \ (n \times m \) is so large
But \ (q \) is much smaller than \ (n \times m \)
In other w ...
Posted by Bobulous on Wed, 27 Apr 2022 15:31:28 +0300
java data structure and algorithm question brushing directory (Sword finger Offer, LeetCode, ACM) --- main directory ------ continuous update (if I can't get in, it means I haven't finished writing): https://blog.csdn.net/grd_java/article/details/123063846
Train of thought analysis
Double pointer traversal method, first get the subs ...
Posted by melissal on Wed, 27 Apr 2022 11:41:31 +0300
Alice and Bob share an undirected graph with n nodes and 3 types of edges:
Type 1: can only be used by Alice traverse.
Type 2: can only be Bob traverse.
Type 3: Alice and Bob can be traversed.
You are given an array edges , where edges[i] = [typei, ui, vi] means that there is a bidirectional edge of type typei between nodes ui and vi . Pleas ...
Posted by Tokunbo on Wed, 27 Apr 2022 02:30:06 +0300
Data structure experiment
Chapter I personal library information management system Chapter II parking lot management Chapter 3 Huffman coding
The sequential representation of linear table is also called sequential storage structure or sequential image. Sequential storage definition: a storage structure that stores logicall ...
Posted by Heero on Tue, 26 Apr 2022 16:42:53 +0300
Today's talk is about merging and sorting. In order to understand merging and sorting more easily, let's first look at an algorithm problem of leetcode. Through the solution idea of this problem, it will make it easier for us to understand the idea of merging and sorting.
the idea of solving this problem is actually th ...
An undirected graph with n nodes is given by adjacency matrix. Each node represents a node in a network. Give another array
Posted by msarefin on Tue, 26 Apr 2022 09:58:44 +0300
Python container you don't know
Python container you don't know
Yesterday, I read the fifth chapter "Common Data Structures in Python" in Python Tricks: The Book, which introduces the usage and precautions of data structures such as dictionary, array, se ...
Posted by omidh on Mon, 25 Apr 2022 14:54:26 +0300
Data structure binary tree entry Go language implementation
We have been talking about one-to-one linear structure before, but in reality, there are still many one to many situations to deal with, so we need to study this one to many data structure - "tree" and consider its various characteristics to solve the relevant problems ...
I HashSet overview
HashSet is an implementation class of Java Collection set. Set is an interface. In addition to HashSet, its implementation class also has TreeSet and inherits the Collection. HashSet Collection is very common and is also a knowledge point often asked by programmers during interview. The following is the structure diagram
Posted by darlingm on Sun, 24 Apr 2022 16:29:03 +0300