Teach you how to use java to realize binary search tree and its related operations
The basic operations of Binary Search Tree include search, maximum, minimum, previous, subsequent, insert and delete.
The time spent on the basic operation of the binary search tree is proportional to the height of the tree. For example, for a complete binary tree with n nodes, the time complexity of the basic operation on it is O(logn). Howev ...
Posted by cauri on Fri, 14 Jan 2022 07:51:45 +0100
Python solves digital baseball games
The number baseball game is played in this way: first, a thinks of a four digit number in his mind, such as 3092. If it is less than four digits, it is supplemented by 0. For example, 12 is considered to be 0012. This number is called the target. B guesses the number. The method is like this. He first randomly says a number to a, such as 5382. ...
Posted by ryeman98 on Fri, 14 Jan 2022 04:42:41 +0100
[Java data structure and algorithm - sequence table 02 (stack)]
1. Stack
1.1 definition of stack
Stack is a linear table that is restricted to insert and delete operations only at the end of the table We call the end that allows insertion and deletion as the top of the stack and the other end naturally as the bottom of the stack; A stack without data elements is called an empty stack; The stack is cha ...
Posted by bahewitt on Fri, 14 Jan 2022 03:18:02 +0100
Data structure_ Tree and binary tree
tree
A tree of nonlinear structures in the logical structure of data
Definition of tree (cycle definition): (1) There is only one root node (2) There are m disjoint trees except the root node, which are called subtrees.Tree representation
Basic terms of trees
Node: an independent unit in a tree. Contains a data element and sev ...
Posted by jtjohnson260 on Fri, 14 Jan 2022 01:07:00 +0100
Tree -- python implementation
tree
Tree is a nonlinear data structure. In the tree, each node contains its own value and its connected child nodes. The line connecting the nodes is called edge. As shown in the following figure, a is the root node and the parent node of B and C, that is, both B and C are child nodes of A. Similarly, B is the parent node of D and E, a ...
Posted by sk8erh4x0r on Thu, 13 Jan 2022 18:42:55 +0100
[LeetCode skimming - data structure]
2022 winter vacation LeetCode question brushing - task 01: linked list
Introduction: the author is basically Xiaobai, so this topic brushing meeting is a difficult process. At the same time, it is also through this team learning to pick up the previous knowledge, and more importantly, it is to expand and consolidate. Therefore, this blog may b ...
Posted by cmason22 on Thu, 13 Jan 2022 17:00:00 +0100
[data structure and algorithm] JavaScript data structure and algorithm reading notes
1. Introduction to JavaScript
2. ECMAScript and TypeScript overview
2.2.7 object oriented programming using classes
class Book {
constructor(title, pages, isbn) {
this.title = title
this.pages = pages
this.isbn = isbn
}
printTitle() {
console.log(this.title)
}
}
let book = new Book('title', 'p ...
Posted by angershallreign on Thu, 13 Jan 2022 16:09:07 +0100
Ten thousand word summary, data structure_ Internal sorting_ A big summary is enough
General classification:
Internal sorting
The amount of data is small, and all data can be sorted in memory. All sorting in this paper is from small to large
1. Insert sort
Insertion sort is one of the simplest sorting methods. In order to ensure the efficiency of random access, insertion sort should use array structure to complete ...
Posted by mark_php on Thu, 13 Jan 2022 15:46:17 +0100
Comparison of Java priority queue (heap) and objects
1, Sequential storage of binary tree
1.1 storage mode
Use the array to save the binary tree structure, that is, the binary tree is put into the array by sequence traversal. Generally, it is only suitable for representing complete binary trees, because incomplete binary trees will waste space. The main use of this approach is the represe ...
Posted by evlive on Thu, 13 Jan 2022 10:37:25 +0100
Quick start ring linked list to solve Joseph problem
The idea of this paper is as follows: 1: What is a circular linked list and where is it used? 2: How to construct a ring linked list 3: Double pointer to solve the problem of circular linked list 4: Summary 5: Share songs Note that this article only talks about the circular linked list composed of single linked list
What is a circular linked l ...
Posted by JonathanV on Thu, 13 Jan 2022 09:54:28 +0100