Data Structure and Algorithms

Data Structure and Algorithms 1. Data structure 1. Data structure includes linear structure and non-linear structure. Linear structure: (1) Sequential storage (array, storage elements are continuous) and chain storage (chain list, storage elements are not necessarily continuous) (2) Arrays, Queues, Chain Lists and Stacks Nonlinear structu ...

Posted by PHPcadet on Thu, 27 Jan 2022 19:02:41 +0100

Implementation principle and application scenario of sparse array

Sparse array Introduction: The following figure is a go board with 11 rows and 11 columns, which is displayed by using a two-dimensional array. At this time, the user needs to save the game. There are two ways to store the game. The first way is to use the two-dimensional array to store it intact on the disk, and the second way is to convert ...

Posted by optik on Thu, 27 Jan 2022 18:39:56 +0100

Leetcode problem solving series -- symmetric binary tree (recursion)

This topic aims to share some interesting or valuable topics found in the process of brushing Leecode. [answer based on js, of course].Recursive algorithm has always been one of the key types of leetcode medium difficulty exercises, so the key is self-evident.Topic relatedOriginal address: https://leetcode-cn.com/problems/dui-cheng-de-er-cha-sh ...

Posted by godwisam on Thu, 27 Jan 2022 15:12:33 +0100

Introduction to algorithm 5: array:

Introduction to algorithm 5: array: introduction: Under the arrangement of the group, we will study the algorithm for three weeks in a unified way this summer vacation. My biggest feeling here is that it's really good for you to be introduced by someone in front. You can take a lot of wrong roads and quickly increase your ability and leve ...

Posted by jrforrester on Thu, 27 Jan 2022 11:05:01 +0100

Layer by layer printing and ZigZag printing of binary tree

Layer by layer printing and ZigZag printing of binary tree Title: Layer by layer printing and ZigZag printing of binary tree "Programmer code interview guide" question 39 P132 difficulty: Wei ★★☆ Printing by layer is originally a very basic content. You can simply traverse the width of the binary tree first. However, there are additio ...

Posted by buckboru on Thu, 27 Jan 2022 10:06:10 +0100

Python data processing and analysis design a high return portfolio (return on investment and risk analysis) task 2: calculate the returns of different types and portfolios

Article catalog 1. Learning objectives 2. Operation explanation 3. Job results 1. Learning objectives Understand simple and logarithmic returnsCalculate the return on investment for different stocks through Pandas and NumPyCalculate the return of the portfolio by linear summation 2. Operation explanation Starting from this task, we wi ...

Posted by Tsukiyomi on Thu, 27 Jan 2022 09:27:56 +0100

LeetCode[4]: find the median of two positively ordered arrays

Give two positively ordered (from small to large) arrays nums1 and nums2 of sizes m and n, respectively. Please find and return the median of these two positive arrays. The time complexity of the algorithm should be O(log (m+n)). Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 Explanation: merge array = [1,2,3], median 2 Exam ...

Posted by mrgrinch12 on Thu, 27 Jan 2022 08:45:01 +0100

[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "next arrangement"

1, Title Requirements An arrangement of an integer array is to arrange all its members in sequence or linear order.For example, arr = [1,2,3], the following can be regarded as the arrangement of arr: [1,2,3], [1,3,2], [3,1,2], [2,3,1].The next permutation of an array of integers refers to the next lexicographically ordered permutation of its i ...

Posted by vboyz on Thu, 27 Jan 2022 07:32:00 +0100

B3602 [graph theory and algebraic structure 202] shortest path problem_ 2 problem solving

I was brushing the water question, but I suddenly found this question. It happened to be what we learned yesterday, so we came to consolidate it. Give it to us n n n points, m m m edge ...

Posted by tomtimms on Thu, 27 Jan 2022 04:30:41 +0100

Topics and partial solutions of the 11th Blue Bridge Cup JavaB group

True question link: Click here Completion Question A: doorplate making (5 points) Problem Description: Brief description of ideas: Solution 1: The while loop decomposes the number on each bit code: public static void main(String[] args) { int ans=0; for(int i=1;i<=2020;++i){ int a=i; while(a!=0){ if(a%10==2)ans ...

Posted by jdimino on Thu, 27 Jan 2022 03:57:14 +0100