Leetcode Hot100 unskilled topic 32 Longest valid bracket

1. Title Description Give you a string containing only '(' and '), and find the length of the longest valid (well formed and continuous) bracket substring. Example 1: Input: s = "(()" Output: 2 Explanation: the longest valid bracket substring is "()" Example 2: Input: s = ") ()" Output: 4 Explanation: the longes ...

Added by mullz on Thu, 17 Feb 2022 12:48:44 +0200

28 | heap and heap sorting: why is heap sorting not as fast as fast sorting?

How to understand "heap" Heap sorting is an in-situ sorting algorithm with time complexity of O(nlogn) There are two characteristics of the heap: A complete binary treeEach node in the heap must be greater than or equal to (or less than or equal to) the value of its left and right child nodes; The heap whose value of each node is g ...

Added by Cogen on Thu, 17 Feb 2022 12:41:55 +0200

Python - constructs a collection of O-time inserts, deletes, and gets random elements

I introduction Design a data structure that supports the following operations under the average time complexity O(1). Note: duplicate elements are allowed. The collection contains the following three functions: A.insert(val): inserts the element val into the collection. B.remove(val): removes a val from the collection when it exists. C.ge ...

Added by dreado on Thu, 17 Feb 2022 07:29:56 +0200

Tree and binary tree

I Trees and forests • tree: one to many structure (1 to 0, 1 to 1, one to many), with a starting point 'root node' • node: a data element of the tree • children: one to many 'many' • subtree: a tree with a child node as its root • leaf nodes: nodes without children • forest: multiple trees II Binary tree ...

Added by daveoffy on Thu, 17 Feb 2022 06:24:47 +0200

[PAT grade B] 1095 decoding PAT admission certificate (25 points)

PAT admission number consists of 4 parts: The first is the level, that is, # T # stands for the top level; A represents class A; B represents class B;The 2nd to 4th digits are the examination room number, ranging from 101 to 999;The 5th to 10th places are the examination date, and the format is year, month and day, accounting for 2 places in s ...

Added by twilitegxa on Wed, 16 Feb 2022 22:02:51 +0200

Sorting of top ten sorting algorithms and implementation in Python and golang language [dynamic graph]

Giant shoulders: https://www.cnblogs.com/onepixel/p/7674659.html https://visualgo.net/zh/sorting https://www.runoob.com/w3cnote/merge-sort.html www.cnblogs.com/binarylei/p/12419863.html blog.csdn.net/qq_27124771/article/details/87651495 ○ summary Sorting algorithmprincipleaverageworstspacestabilityBubble sortingAdjacent elements are exchang ...

Added by dsinghldh on Wed, 16 Feb 2022 13:14:10 +0200

Data structure diagram (storage structure)

Definitions and basic terms of drawings   Figure: G=(V, E)    Grapg = (Vertex, Edge)    V: finite non empty set of vertices (data elements);   E: finite set of edges Undirected graph: each edge is undirected Directed graph: each edge has a direction Complete graph: any two points have an edge connected Sparse gr ...

Added by stormszero on Wed, 16 Feb 2022 06:47:56 +0200

C++ STL notes 13: STL common algorithms 3: common sorting algorithms;

Algorithm Introduction: Sort / / sort the elements in the containerrandom_shuffle / / shuffle and randomly adjust the order of elements within the specified range.merge / / the container elements are merged and stored in another container.reverse / / reverses the elements of the specified range. sort Function Description: Sort the ele ...

Added by tommy445 on Wed, 16 Feb 2022 06:48:33 +0200

c language data structure, you may not know the sequence table

Python wechat ordering applet course video https://edu.csdn.net/course/detail/36074 Python actual combat quantitative transaction financial management system https://edu.csdn.net/course/detail/35475 Data structure sequence table Sequence table definition 1. Preface The sequential storage of linear table is also called sequential table. I ...

Added by dark_destroyer on Wed, 16 Feb 2022 00:21:39 +0200

100 examples of C language topic exercises - topic + topic analysis + source code (71-80)

[Title 71] Title: write a function. When the input n is an even number, call the function to find 1 / 2 + 1 / 4 +... + 1/n. when the input n is an odd number, call the function 1 / 1 + 1 / 3 +... + 1/n (using pointer function). 1. Topic analysis: 2. The source code of the title is as follows: #include "stdio.h" #include "stdlib.h" double even ...

Added by djKale on Tue, 15 Feb 2022 16:25:40 +0200