Three ways of traversing trees and their breadth
Algorithmic Base-Tree
Three ways to traverse a tree (recursive)
The three recursive traversals of trees are based on recursive order. The so-called recursive order is that each node returns to that node three times if it uses recursion. For example: The so-called recursive order is that each node traverses three times, so when using recursion ...
Posted by verdrm on Sun, 07 Nov 2021 08:02:43 -0800
Codeforces 103389j maximum weight edge independent set
Maximum weighted edge independent set
It's really a hand speed field. It belongs to yes. I can only say that I'm lucky. No wa, Jinwei
Laishui blog
At that time, there was a mistake. Of course, some strings were unfamiliar. When I saw J, I felt like a tree dp. Although I couldn't figure out the details in the game, the general direction ...
Posted by PhaZZed on Sat, 06 Nov 2021 23:04:38 -0700
Summary of basic algorithms
Bit operation
Pilot brother
Title Link
Problem solving ideas:
Each switch of the chessboard has two states: on or off, so the total number of States is
2
16
2^{16}
216. The range of int is not ...
Posted by thallium6 on Sat, 06 Nov 2021 18:01:47 -0700
SP6779 GSS7 - Can you answer these queries VII
Title Link: SP6779 GSS7 - Can you answer these queries VII
General meaning
Given a tree with
n
n
A tree with n nodes, each node has a weight
w
i
(
...
Posted by Ghost_81st on Sat, 06 Nov 2021 13:27:50 -0700
Week 1 algorithm learning and sorting
Weekly summary of algorithm practice (10.31-11.6)
Learning objectives:
One week elementary practice of algorithm
Learning content:
1. Question: call fee calculation 2. Problem: time conversion 3. Problem: Abbreviated summation 4. Problem: word encryption 5. Problem: monkeys eat peaches
Study time:
1. 7 p.m. - 9 p.m. from Monday to ...
Posted by SieRobin on Sat, 06 Nov 2021 13:05:49 -0700
Manually tear the minimum heap (rebuild heap + insert data + delete data code explanation + example)
Recommended blog and video explanation
Heap sort (heap rebuild + insert + delete detailed explanation) UP Master: bald girl Wang pushed
Forward citation
I didn't get up until 10 o'clock today. I really don't know why I got up late. Of course, it's also the weekend, but I still have to do things when I got up so late. In the da ...
Posted by pagie on Sat, 06 Nov 2021 10:44:39 -0700
The decision tree picks the watermelon
1, ID3 algorithm
1. Ladle
import numpy as np
import pandas as pd
import sklearn.tree as st
import math
import matplotlib
import os
import matplotlib.pyplot as plt
2. Read data
data = pd.read_csv('C:/Watermelon dataset.csv',header=None)
data
3. Coding
entropy
def calcEntropy(dataSet):
mD = len(dataSet)
dataLabelList = [x[-1] f ...
Posted by CWebguy on Sat, 06 Nov 2021 10:26:57 -0700
Merge sort algorithm - C++
The main idea of merge sort algorithm is to merge two ordered arrays into an ordered array. Its key point adopts the "divide and conquer idea". The "divide" is a dichotomy, which divides the unordered array into ordered arrays, and then through the "divide and conquer" Merge two ordered arrays into one orde ...
Posted by matvespa on Sat, 06 Nov 2021 10:08:50 -0700
Code clipping algorithm for line segment
Code clipping algorithm for line segment
For example, many uneven straight-line segments are distributed on a canvas, and we want to find a rectangular window on the canvas and only want to get the straight-line segments in the rectangular window. How should we achieve this? We know that the straight line segment can be expressed by a para ...
Posted by Jeyush on Fri, 05 Nov 2021 23:45:29 -0700
[ye shisan] summary of the most complete knowledge of data structure and algorithm
Brain map: https://www.processon.com/mindmap/6179408f0e3e7416bdeb81d1
development environment
Mac C locale configuration
Software: Visual Studio Code
Coder Runner plug-in
1, Overview of data structures
1. Definition
How do we save a large number of complex problems in reality to the main memory (memory) with specific data type ...
Posted by High_-_Tek on Fri, 05 Nov 2021 22:34:06 -0700