Shangsilicon Valley java data structure and algorithm learning notes

Linear structure and nonlinear structure Sparse array SparseArray demand Recording the position of the chessboard can be saved with a binary array, but it will be found that recording a lot of meaningless data and a lot of space waste can be optimized with a sparse array introduce Sparse array is to compress redundant data The firs ...

Posted by billy_111 on Mon, 02 May 2022 15:25:11 +0300

Create binary tree and hierarchical traversal according to generalized table

[problem description] true topic of postgraduate entrance examination: given a binary tree, it is required to traverse the binary tree from bottom to top by layers. The access order of each layer is from left to right, and each layer outputs a separate line. [input form] a binary tree represented by a generalized table. The node element type i ...

Posted by Iki on Mon, 02 May 2022 03:28:33 +0300

[data structure] (initial stage): linear table

 ​ ✨ preface ✨ 🎓 Author: [leader] ☕ The level of bloggers is limited. If there is any error, please correct it. 📌 Opportunities are always reserved for those who are prepared. The harder you work, the luckier you are! 💦 Navigation assistant 💦 ​​​​​​​ catalogue Linear table Sequence table Concept and structure of ...

Posted by new2phpcode on Sun, 01 May 2022 20:10:01 +0300

Data structure and algorithm day 7 common sorting + bubble sorting + quick sorting + file IO + big data sorting + file merging

If you really can't understand it, memorize it by rote. If you don't want to memorize it, treasure it Chapter I bubble sorting Bubble Sort is also a simple and intuitive sorting algorithm. It repeatedly visits the sequence to be sorted, compares two elements at a time, and exchanges them if they are in the wrong order. The work of visiti ...

Posted by nitm on Sun, 01 May 2022 19:51:41 +0300

[basic operation summary of binary tree 1]

//Binary tree linked list storage #include<iostream> #include<queue> #include<algorithm> const int N=1e5+10; using namespace std; struct BiNode{ char data; BiNode *lchild,*rchild; }; class BiTree{ private: BiNode* root; public: BiTree(){root=create(root);} ~BiTree(){release(root);} BiNode* getRoot(){return root;} ...

Posted by nano on Sun, 01 May 2022 19:07:09 +0300

Design the smallest stack, that is, there are the basic operations of the stack, push, pop, peek, and the function of returning the minimum value in the stack, getMin

Design the smallest stack, that is, there are the basic operations of the stack, push, pop, peek, and the function of returning the minimum value in the stack, getMin Tip: previously, we said that the system stack can push, pop and peek normally Now we need to design a minimum stack, and the o(1) speed returns the minimum value in the current ...

Posted by dragon_sa on Sun, 01 May 2022 01:52:25 +0300

Draw a monotonic stack for solving data structure problems

Monotone stack First question The implementation class is typedef and implements this class with array or int or other classes typedef struct { int stack[10000]; int stacktop; int minstack[10000]; int minstacktop; }MinStack;//Auxiliary stack, the minimum value of stack top storage; MinStack* minStackCreate() { MinStack* ...

Posted by davitz38 on Sat, 30 Apr 2022 20:38:16 +0300

Java language description -- Design and implementation of single linked list -- data structure

Data structure -- Design and implementation of single linked list First understand its definition: Single linked list: if each node is set with only one pointer member pointing to the subsequent node, such a linked list is called linear one-way linked list, or single linked list for short. What is a pointer member? In the linked list, each nod ...

Posted by pheagey on Sat, 30 Apr 2022 20:18:10 +0300

Depth and breadth first traversal of Graphs

First introduce the structure of two kinds of graphs Adjacency matrix: A one-dimensional array is used to store the vertices in the graph, a two-dimensional array is used to represent the relationship between elements, and the row, column and their values are used to represent whether there is an edge (ARC) between the two vertices. If the va ...

Posted by matthewlesh on Sat, 30 Apr 2022 04:43:12 +0300

A text will take you to understand binary tree

introduction Original link: A text will take you to understand binary tree I hope you can pay attention to my official account. There is a QR code at the end of the text. Thank you!   1. Basic concepts of binary tree   Binary tree definition: the degree of a node is at most 2 Five forms of binary tree: Empty binary tree There is only ...

Posted by fahrvergnuugen on Sat, 30 Apr 2022 01:27:55 +0300