Algorithm design and analysis hash function and hash table

hash function Basic concepts: out = f( in )in input field, which is infinite by default; out output field, finiteThe same input returns the same output value (there is no random component in the hash function)Different inputs may produce the same output (hash collision, very low probability)Hashing of hash function: the hash function sho ...

Added by zerGinfested on Mon, 31 Jan 2022 08:40:13 +0200

Eight sorting algorithms

The so-called sorting is the operation of arranging a string of records in ascending or descending order according to the size of one or some keywords. Sorting algorithm is how to arrange records according to requirements. There are roughly eight commonly used sorting algorithms: insertion sort (direct insertion sort, Hill sort), selection sort ...

Added by dsandif on Mon, 31 Jan 2022 06:07:15 +0200

Byte runout algorithm topic summary

Byte beat favorite 64 algorithm questions (JS version) April 12 The following article is from the Tuque community. The author is a Tuque Tuque community Collect wonderful practical tutorials, pay attention to the reply "communication", pull you into the learning and communication group, and grow together with small partners who ...

Added by tsapat on Mon, 31 Jan 2022 04:53:20 +0200

P2372 yyy2015c01 challenge perimeter

Topic background Yyy2015c01 quickly solved the problem, was praised by the neighbors, happily returned home, gave the sugar to my mother, had a delicious lunch and took a sweet nap. I feel that life is really beautiful. In the afternoon, my father came home and heard that yyy2015c01 had helped the teacher and neighbors solve their problems. He ...

Added by markjohnson on Mon, 31 Jan 2022 00:15:52 +0200

Freecodecamp JavaScript elementary algorithm question-1

1. Convert degrees Celsius to degrees FahrenheitThe conversion from Celsius to Fahrenheit is calculated by multiplying Celsius by 9 / 5 and then adding 32Input: convertToF(0) should return a numberInput: - 30Output: - 22Where celsius stands for celsius and fahrenheit for fahrenheitSolution:function convertToF(celsius) { let fahrenheit; fahr ...

Added by 990805 on Sun, 30 Jan 2022 22:41:52 +0200

JAVA exercise 64 - serialized binary tree

Please implement two functions to serialize and deserialize the binary tree respectively. You need to design an algorithm to realize the serialization and deserialization of binary tree. There is no restriction on the execution logic of your sequence / deserialization algorithm. You only need to ensure that a binary tree can be serialized into ...

Added by Benny Johnson on Sun, 30 Jan 2022 22:19:59 +0200

[high frequency question] leetcode 907 Sum of subarray minima

Title Description & Links Leetcode 907 : given an array, find the minimum values of all subarrays and return the sum of all minimum values Topic idea 1. Enumeration of violence The intuitive idea is to enumerate all subarrays through violence and find the sum of the minimum values of all subarrays, because the topic subarray refers to c ...

Added by RickyF on Sun, 30 Jan 2022 20:33:44 +0200

JAVACC Usage Summary: through four arithmetic analysis, explore syntax analysis

Grammar analysis JavaCC generates a top-down parser that does not support left recursion and recursive descent. The advantage of this parser is that the syntax is easy to understand and easy to debug. Attributes can be passed up and down in the syntax parsing tree, and can also be called between branches. As shown in the figure: Left recurs ...

Added by Chamza on Sun, 30 Jan 2022 16:15:27 +0200

Learning notes -- recursive implementation of quick sorting

Note: all the data used in my test are of the type that can be compared in size without duplicate elements, and the sorting is in ascending order. In fact, the idea of fast sorting is very similar to bubble sorting. Bubble sorting is to complete the sorting through the continuous exchange between two adjacent elements. I think fast sorting ...

Added by Techissue2008 on Sun, 30 Jan 2022 15:54:24 +0200

[algorithm cultivation] dynamic programming topic 2: knapsack type problem

Learning from: https://labuladong.gitee.io/algo/3/25/85/ 1, 0-1 knapsack problem Give you a backpack with a weight of W and N items. Each item has two attributes: weight and value. Among them, the weight of the ith item is wt[i], and the value is val[i]. Now, what is the maximum value of the item you can pack with this back? It should be n ...

Added by Helljumper on Sun, 30 Jan 2022 15:33:13 +0200