Adjacency matrix implementation based on C++

Adjacency matrix (note the directed adjacency matrix graph implemented here) The adjacency matrix of a graph is stored in two arrays. A one-dimensional array stores the vertex information in the graph, and a two-dimensional array (adjacency matrix) stores the edge or arc information in the graph. Let graph G have n vertices, then the adjacency ...

Added by smartknightinc on Thu, 24 Feb 2022 12:17:08 +0200

Detailed explanation of stack usage

1, Demand Please enter an expression calculation formula: [722-5 + 1-5 + 3-3] Click calculation [as shown below] Excuse me: how does the bottom layer of the computer calculate the result? Note that it is not a simple operation to list the formula, because we look at the formula 7 * 2 * 2 - 5, but how the computer understands the formula (for ...

Added by Punk Rock Geek on Thu, 24 Feb 2022 10:14:23 +0200

O(NlogN) sorting algorithm

Recognize the sorting algorithm of O(NlogN) 1. Analyze recursive behavior and estimate its time complexity Recursive process: the recursive process is a multi fork tree. The process of calculating the nodes of all trees is to use the stack for post order traversal. Each node can continue to return upward only after summarizing information to ...

Added by PeeJay on Thu, 24 Feb 2022 09:46:10 +0200

Hash table of data structure

Hash table, also known as hash table, can also be translated into hash table directly. Hash table is a data structure that can be accessed directly according to key - value. It is based on the array and speeds up the search speed by mapping keywords to a subscript of the array. However, it is different from the data structures such as array, li ...

Added by realestninja on Thu, 24 Feb 2022 05:25:55 +0200

Classic example of sliding window (maximum and minimum)

Simple concept of sliding window Sliding window is a hypothetical data structure. The window we implement in this article can quickly find the maximum and minimum value of the interval The operation efficiency is also excellent in some problems that do not go back in the interval Set the left boundary of the window as l and the right boundar ...

Added by parboy on Wed, 23 Feb 2022 17:27:24 +0200

leetcode basic programming: linked list

148. Remove linked list elements Difficulty: simple Collection Give you a head node of the linked list and an integer val. please delete all nodes in the linked list that meet the requirements Val = = Val node and returns a new header node. Example 1: Input: head = [1,2,6,3,4,5,6], val = 6 Output: [1,2,3,4,5] Example 2: Input: head = [], va ...

Added by vronsky on Wed, 23 Feb 2022 12:48:47 +0200

[daily series] appreciation of recursion from introduction to mastery (C + + version)

Recursion from introduction to mastery (I) introduction to recursion Write a recursive function What is the function of this recursive function and how to call this function, that is, design the return value and parameter list of the recursive functionWhen should this recursion end and what is its boundary condition (exit)How to change from ...

Added by rocksolidhq on Wed, 23 Feb 2022 11:19:52 +0200

Depth of binary tree, sum of paths, conversion of ordered array into binary search tree, binary search tree iterator (2022 / 02 / 23)

104. Depth of binary tree Difficulty: simple Given a binary tree, find its maximum depth. The depth of the binary tree is the number of nodes on the longest path from the root node to the farthest leaf node. Note: leaf nodes refer to nodes without child nodes. Example: Given binary tree [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 Returns it ...

Added by idevlin on Wed, 23 Feb 2022 10:56:25 +0200

[Kaka on Java] in depth analysis of HashMap source code [key]

   students, today we will deeply analyze the source code of HashMap. I believe many students will be asked about the source code during the interview. Which one is the most asked? Most students will definitely think of HashMap. Through the study of this article, you will be able to easily master the source code knowledge of HashMa ...

Added by KindredHyperion on Wed, 23 Feb 2022 10:33:19 +0200

Graphical python | data structure

Author: Han Xinzi@ShowMeAITutorial address: http://www.showmeai.tech/tuto...Article address: http://www.showmeai.tech/article-detail/83Notice: All Rights Reserved. Please contact the platform and the author for reprint and indicate the sourcePython 3 data structureThere are a large number of data structures and containers in Python for programm ...

Added by sakaveli on Wed, 23 Feb 2022 09:24:37 +0200