[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "stone game VI"

1, Title Requirements Alice and Bob play a game in turn. Alice takes the lead. There are n stones in a pile of stones. When it's a player's turn, he can remove a stone and get the value of the stone. Alice and Bob have different criteria for the value of stones. Both sides know each other's criteria.Give you two integer arrays of length n, ali ...

Posted by yuan22m on Mon, 03 Jan 2022 22:42:33 +0100

Advanced sort: quick sort (super detailed)

I summary Quick sort is an improvement of bubble sort. Its basic idea is to divide the data to be sorted into two independent parts through one-time sorting. All the data in one part is smaller than all the data in the other part, and then quickly sort the two parts of data according to this method. The whole sorting process can be recursive, s ...

Posted by Ristiisa on Mon, 03 Jan 2022 21:19:42 +0100

Python advanced training - Num1, inheritance, polymorphism

Class: used to describe a collection of objects with the same properties and methods. It defines the properties and methods common to each object in the collection. An object is an instance of a class.Inheritance: that is, a derived class inherits the fields and methods of the base class. Inheritance also allows the object of a derived class to ...

Posted by marcusb on Mon, 03 Jan 2022 19:50:33 +0100

Introduction to C language single linked list (with examples)

"Ctrl AC! Together AC!" catalogue preface: Definition and node of single linked list: Definition of single linked list: Structure of single linked list node: Establishment of single linked list: Insert a new node with data x into the single linked list: Create linked list by tail interpolation: Traversal of single linked list ...

Posted by DirtySnipe on Mon, 03 Jan 2022 13:08:26 +0100

A case of HDU 1425 illustrates the process of bubble sorting and quick sorting

Detailed bubble sort and quick sort Generally speaking, the questions given by the competition generally have a variety of solutions. It assesses the problem-solving in a limited time and space. If the conditions are very loose, you can choose the easiest algorithm to program among a variety of solutions; If the given conditions are harsh, the ...

Posted by kaisellgren on Mon, 03 Jan 2022 09:30:49 +0100

[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "stone game V"

1, Title Description Several stones are arranged in a row. Each stone has an associated value. The associated value is an integer, which is given by the array stoneValue.Each round of the game: Alice will divide the line of stones into two non empty lines (i.e. the left line and the right line); Bob is responsible for calculating the value of ...

Posted by Hobgoblin11 on Mon, 03 Jan 2022 09:08:51 +0100

Eight sorting, time complexity and space complexity

1. Complexity 1.1 time complexity Total execution times of statements: t (n) = O (f (n)) f (n) is a function of the problem scale n. It means that with the increase of problem scale n, the growth rate of algorithm execution time is the same as that of F (n). Generally, we only care about the term that has the greatest influence on the result ...

Posted by Mikemcs on Mon, 03 Jan 2022 08:07:31 +0100

❤️ "Disgusting work" a blog takes you to master the "five core algorithms" ❤️

catalogue 1, Divide and conquer Ideological principle Specific steps Example 1 Algorithm conclusion 2, Dynamic programming algorithm Ideological principle Specific steps Algorithm implementation Algorithm conclusion 3, Backtracking algorithm         Algorithmic thought         Basic steps         Example 2         Algorithm imp ...

Posted by miraclewhipkey on Mon, 03 Jan 2022 07:23:48 +0100

Basic implementation of sequence table

1. Header file What I'm talking about here is the dynamic sequence table. Of course, the operation of the static sequence table is basically the same, but the static sequence table cannot be expanded. The quantity is controlled, which will cause a waste of space. Static sequence table #pragma once / / prevent header file from containin ...

Posted by saviiour on Mon, 03 Jan 2022 03:46:05 +0100

Data structure learning plan W1

Will share some classic exercises and solutions being done, and write your own understanding if you are interested. If you are interested, you can refer to it. There are duplicate elements Given an integer array, determine whether there are duplicate elements. If a value exists and appears in the array at least twice, the function returns ...

Posted by Viper76 on Mon, 03 Jan 2022 02:20:32 +0100