Greedy algorithm and joint search set and graph

As for the greedy algorithm, what Zuo Shen summarized in the online class is actually amorphous, that is, we generally obtain the correct greedy strategy by trying different greedy strategies, and verify whether the choice of greedy strategy is correct by logarithmic method. In fact, you should brush more relevant questions and feel the correc ...

Posted by simcoweb on Thu, 21 Apr 2022 08:14:18 +0300

Data structure Exercise 1 - linear table

🥪🥪🥪 Hello, everyone. I'm cookie 🍪, A primary school student in the programming world hopes to learn a little programming related every day. Recently, I saw many partners learning data structure on CSDN. Today, I share some exercises for you to consolidate your knowledge. Some questions are attached with some of my own opinions. Thank you f ...

Posted by phpwolf on Thu, 21 Apr 2022 02:48:36 +0300

Abstract factory of java design pattern

Abstract factory pattern introduce Intent: provide an interface to create a series of related or interdependent objects without specifying their specific classes. Main solution: mainly solve the problem of interface selection. When to use: the products of the system have more than one product family, and the system only consumes the products of ...

Posted by Altec on Wed, 20 Apr 2022 23:40:17 +0300

"Algorithm notes" polynomial multiplication and FFT

1, Introduce First, define the form of polynomial as \ (f(x)=\sum_{i=0}^n a_ix^i \), where \ (a_i \) is the coefficient and \ (n \) is the degree. This representation method is called "coefficient representation", and a polynomial is determined by its coefficient. It can be proved that \ (n+1 \) points can uniquely determine a \ (n \) ...

Posted by xgab on Wed, 20 Apr 2022 21:25:48 +0300

Sorting methods (8) detailed explanation 6 - quick sorting

catalogue 1. Quick sort overview Principle: Illustration: Time and space complexity: 2. Quick sort classification Quick sort (recursive version) Quick sort (recursive optimization version): (filter better benchmark numbers, and insert sort is adopted for shorter intervals) 3. Code implementation and running results main function: Quic ...

Posted by nnichols on Wed, 20 Apr 2022 17:08:29 +0300

[code Capriccio] column of binary tree and binary search tree (java version with comments)

preface For the supplement of the following code, see the following link: Binary tree theory and code in code Capriccio This paper mainly studies according to the learning route of the link, reading its ideas and self cognition, and adding code comments Convenient for self-study, interested students can also collect and pay attention The ...

Posted by XPertMailer on Wed, 20 Apr 2022 08:16:34 +0300

GSS7 - Can you answer these queries VII segment tree

I did it for 4 hours, thought for an hour, typed the code for 20 minutes and debugged for 2 and a half hours I didn't see the solution of the problem. I was used to the segment tree of the array version, so I couldn't return multiple parameters like the structure, so I used reference to return Knowledge required: tree section, nearest common ...

Posted by padma on Wed, 20 Apr 2022 03:59:47 +0300

Shell array sorting algorithm

1 array sorting [root@localhost shuzu]# vim paixu1.sh #!/bin/bash arr=(63 4 24 1 3 15) echo "The array order before sorting is: ${arr[@]}" list=$(echo ${arr[@]} | tr ' ' '\n' | sort -n) a=0 for i in $list do arr[$a]=$i let a++ arr1+=($i) done echo "The sorted array order is: ${arr[@]}" 2 bubble sorting Similar to the action o ...

Posted by dcjones on Tue, 19 Apr 2022 17:52:37 +0300

Single linked list algorithm design (including large factory interview questions)

1. Introduction to single linked list and memory layout The linked list is an ordered list, but it is stored in memory as follows: Summary: 1) Linked list is stored in the form of nodes, which is chain storage 2) Each node contains data field and next field: point to the next node 3) As shown in the figure: it is found that each node of t ...

Posted by cooler75 on Tue, 19 Apr 2022 13:06:47 +0300

GPLT - shortest circuit problem of ladder race

1. L3-1 straight attack Huanglong (30 points) Idea: this problem is a dijkstra, but the difference is that it has multiple variables of update paths. We need to judge them one by one. However, it should be noted that for the initialization of the matrix, we must initialize all of them to positive infinity, and we cannot initialize ourselves to ...

Posted by waltonia on Tue, 19 Apr 2022 11:26:53 +0300