Aha! Algorithm Chapter 2 - Section 1 - decrypt QQ number

Decrypt QQ number - queue The new semester begins. Xiaoha is xiaohum's new deskmate (xiaoha is a little beauty). Xiaohum asks xiaoha about the QQ number. Of course, xiaoha won't tell xiaohum directly. You know the reason. So xiaoha gave xiaohum a string of encrypted numbers, and xiaoha also told xiaohum the decryption rules. The rule is as f ...

Posted by srikanthiv on Mon, 23 May 2022 14:04:57 +0300

Treap learning notes 2020.8.12

If the insertion order of nodes in a binary sort tree is random, the binary sort tree established in this way is balanced in most cases. It can be proved that its high expectation value is \ (O (\ log_2 n) \). Even if there are some extreme cases, the probability of this happening is very small. Moreover, the operation of the binary sort tree e ...

Posted by robindean on Mon, 23 May 2022 05:59:12 +0300

Three common implementation classes of Java List interface

List three common sets ArrayList (key) ArrayList is a typical implementation class and main implementation class of the List interface. In essence, ArrayList is a "variable length" array of object references. summary ArrayList class is an array that can be dynamically modified. The difference from ordinary arrays is that it has no f ...

Posted by techcone on Sun, 22 May 2022 10:18:32 +0300

Sparse array of data structures

Based on the realization of two-dimensional sparse array, I will sort out the concept and application of sparse array. 1. Concept In fact, it is still an array. Through the regulations, the elements of the array are given specific meanings, and the array with a small amount of data but a large space is saved with a small storage space.    Re ...

Posted by RaythMistwalker on Sun, 22 May 2022 07:53:07 +0300

Java sort Bubble

Bubble sorting 1. What is Bubble sorting? Bubble Sort is the most basic exchange sort. The reason why it is called bubble sorting is that each element can be sorted bit by bit according to its own size like a small bubble array Move to one side of the. Principle of bubble sorting: Only one number can be determined to be returned in each tr ...

Posted by iarp on Sun, 22 May 2022 02:48:53 +0300

[Data structure] chain stack

definition Chained stack is a data storage structure, which can be implemented in the form of a singly linked list. The advantage of using a chained stack is that it can overcome the low space utilization of sequential stacks implemented with arrays, but it needs to be used for each stack element. Allocate additional pointer space for storing ...

Posted by roughie on Sun, 22 May 2022 02:28:20 +0300

Improvement of binary tree traversal algorithm (non recursive implementation)

Improvement of binary tree traversal algorithm The depth first traversal algorithms of binary tree are implemented by recursive functions, which is very inefficient. The reason is that the system calls a stack and does complex operations such as protecting the site and restoring the site, so that the traversal can be realized by very simple cod ...

Posted by Verrou on Sun, 22 May 2022 02:06:38 +0300

JAVA data structure and algorithm -- single chain surface test questions (Sina, Baidu, Tencent)

Common interview questions of single linked list Find the number of effective nodes in the single linked list Find the penultimate node in the single lin k ed list (Sina) Reversal of single linked list (Tencent) Print the single linked list from end to end (Baidu requires mode 1: reverse traversal. Mode 2: stack stack) Example 1: find the ...

Posted by lin on Sat, 21 May 2022 17:37:32 +0300

Merge sort and search

Merge sort Merge sort is a very typical application of divide and conquer. The idea of merging and sorting is to recursively decompose the array, and then merge the array. After the array is decomposed to the minimum, and then two ordered arrays are merged. The basic idea is to compare the front numbers of the two arrays. Whoever is small will ...

Posted by adam_gardner on Sat, 21 May 2022 05:32:56 +0300

Big talk data structure - Summary

Big talk data structure - Summary Read the book "Dahua data structure" and summarize some things; The summary is rough. Some ideas can't be understood for the time being. Put them aside first, and then go back to digest these knowledge points after learning other things 1. Data structure A data structure is a collection of ...

Posted by redrabbit on Sat, 21 May 2022 01:17:44 +0300