Principle analysis and code implementation of BST (binary search tree)

brief introduction As a classical data structure, binary search tree not only has the characteristics of fast insertion and deletion of linked list, but also has the advantage of fast search of array; Introduction to binary search tree Binary Search Tree: BST (Binary Search Tree), for any non leaf node of the Binary Search Tree. The valu ...

Posted by Unipus on Fri, 28 Jan 2022 00:55:25 +0100

2021-06-21 repeating elements in ordered linked list 2

leetcode daily question of deleting duplicate elements in the sorting linked list Title Link: https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/submissions/ Title Description: There is a linked list arranged in ascending order. Give you the head node of the linked list. Please delete all nodes with duplicate numbers in t ...

Posted by DavidT on Fri, 28 Jan 2022 00:39:54 +0100

2045. Second short time to destination

Difficulty: difficulty catalogue 1, Problem description 2, Problem solving thought 3, Problem solving 1. Judge extreme situations 2. Code implementation 4, Summary 1, Problem description The problem description above LeetCode is directly used here. Cities are represented by a two-way connected graph, in which there are n nodes, numbe ...

Posted by habs20 on Thu, 27 Jan 2022 23:53:54 +0100

Implementation of two-way circular linked list with the leading node of linked list

catalogue I: 2, Implementation: Three, end I: The linked list is divided into eight categories. This article describes the implementation of the two-way circular linked list of the leading node; The physical structure of such linked list is shown in the figure below: There are two pointers in each node, pointing to the previous no ...

Posted by dibyajyotig on Thu, 27 Jan 2022 23:33:12 +0100

LeetCode 23. Merging K Ascending Chain Lists & Merging Ordered Chain Lists

Title Requirements Link to the original title: 23. Merge K Ascending Chain Lists The Title requirements are as follows: Give you an array of lists, each in ascending order. Please merge all lists into one ascending list and return the merged list. Examples are as follows: Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] ...

Posted by kesmithjr on Thu, 27 Jan 2022 19:54:38 +0100

Preliminary C + + - STL - string class, vector class and list class (use method + simulation implementation + test + idea analysis)

From today on, we officially enter the study of STL. Today we will focus on three classes -- string vector and list catalogue Introduction to STL STL version Six components of STL: Defects of STL: (understand) string class introduce Common structure description of string class 1. Common construction classes 2. Capacity operation ...

Posted by networkthis on Thu, 27 Jan 2022 19:20:15 +0100

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

Java data structure - single linked list

What is a linked list The data structure of array is continuous storage space. Because the space is continuous, the efficiency of accessing is very high, but the efficiency of deleting and inserting data at the same time is very low. Therefore, the concept of linked list is proposed Unlike arrays, linked lists are not stored continuously ...

Posted by chuddyuk on Thu, 27 Jan 2022 12:06:44 +0100

C language - Joseph problem (Joseph Ring)

Joseph problem is also called Joseph Ring. Joseph problem has many variants. This paper introduces several solutions to several classical Joseph problems. Question 1: Lu Zhishen eats steamed bread. It is said that Lu Zhishen hurried to daxiangguo temple in Kaifeng at noon one day and wanted to have a meal. At that time, there were 99 monks ...

Posted by BeanoEFC on Thu, 27 Jan 2022 09:13:33 +0100