Time complexity analysis of dfs

preface I have been thinking about the complexity of dfs for a few days, but I don't understand it now. The storage methods of graphs are chained forward stars or adjacency matrices. This paper mainly expounds the calculation method of dfs time complexity through several classic topics. $n $is the number of nodes in the graph, $e $is the number ...

Added by joejoejoe on Thu, 03 Feb 2022 01:50:31 +0200

A stack for solving data structure (implemented in C language)

What is stack? Stack: a linear table that allows insertion or deletion operations only at one end (limited to the end of the table). Therefore, for the stack, there is a distinction between the top and bottom of the stack. The details are as follows: Therefore, when using stack storage, there is a law of first in and last out. When we sto ...

Added by phpfan on Wed, 02 Feb 2022 23:38:10 +0200

Addition, deletion and modification of c language single linked list

1. Basic structure of linked list The linked list is connected by nodes. The node here is a structure, which is composed of data field and pointer field. typedef int SListDateType typedef struct SListNode { SListDataType data;//The data variable is used to store data struct SListNode* next;//Next points to the next node; }SListNode; ...

Added by idire on Wed, 02 Feb 2022 18:08:08 +0200

Prepare for the second test, three questions a day, Day25

Prepare for the second test, three questions a day Topic 1: delete nodes in the linked list Please write a function to delete a specific node in the single linked list. When designing the function, you should pay attention to that you cannot access the head node of the linked list. You can only directly access the node to be deleted. The top ...

Added by aminnuto on Wed, 02 Feb 2022 17:55:45 +0200

Triumph Day9 -- a first acquaintance with C++ STL

catalogue 2. STL acquaintance 2.1 birth of STL 2.2 basic concepts of STL 2.3 STL six components 2.4 containers, algorithms and iterators in STL 2.5 initial knowledge of container algorithm iterator 2.5.2 Vector stores user-defined data types 2.5.3 Vector container nested container 2. STL acquaintance 2.1 birth of STL For a lon ...

Added by djpic on Wed, 02 Feb 2022 17:34:27 +0200

Palindrome structure of linked list (algorithm notes)

Head changing problem of single linked list If the algorithm related to the single linked list involves the head changing operation, the method needs to return the value Simple question 1 Print the common part of two ordered linked lists Question two Judge whether a linked list is palindrome structure [title] given the head node of a singl ...

Added by Dude0 on Wed, 02 Feb 2022 15:47:13 +0200

[Java data structure and algorithm] linked list includes: single linked list, two-way linked list, ring linked list and Joseph problem

Introduction to linked list 1 linked list is stored in the form of nodes, which is chain storage 2. Each node contains data field and next field: points to the next node As shown in the figure: it is found that each node of the linked list is not necessarily stored continuously 4 the linked list is divided into the linked list with the le ...

Added by murtoz on Wed, 02 Feb 2022 14:59:38 +0200

UCOS III learning record - ready list

Happy year of the tiger! I wish you greater progress next year! Reference content: Chapter 11 of [wildfire] uCOS-III Kernel Implementation and application development Practical Guide - based on STM32. 1 definition of ready list and task control block (os.h) 1.1 task control block linked list OS_TCB Before defining the ready list, modify ...

Added by Rocu on Wed, 02 Feb 2022 12:16:21 +0200

Improvement of dynamic programming method for LCS problem: time complexity O (Mn * (min (m, n)), space complexity O

LCS problem is the problem of finding the longest common subsequence of two strings. The common solutions to this problem are ordinary recursive method and dynamic programming method. The general recursive method adopts the ideas of reducing and governing and dividing and governing. However, the algorithm has a large number of repeated calcula ...

Added by kanchan on Wed, 02 Feb 2022 11:21:12 +0200

Data structure - heap

Concept: Heap is also called priority queue. When entering the queue, it is the same as ordinary queue, but when leaving the queue, the elements with higher priority are given priority. When the priority is the same, it is carried out in the way of first in first out. The essence of heap is actually a binary tree, and this binary tree needs to ...

Added by goatboy on Wed, 02 Feb 2022 10:38:41 +0200