After learning unlink in the early stage, I found a question called unlink in NSSCTF today and tried to do it without looking at wp. The process went smoothly! Foreword The questions are very bare in terms of unlinking knowledge points, very direct, and the ideas are very clear. 1. Title 2. Brief analysis of […]
Tag: heap
Data structure-heap sort and its complexity calculation
Table of Contents 1. Heap sort 1.1 Adjust heap construction upward 1.2 Adjust heap construction downwards 2. Comparison of time complexity between two heap building methods 2.1 Adjust downward the time complexity of heap building 2.2 Adjust the time complexity of heap construction upward Topk problem In the previous section, we talked about Heap implementation, […]
java data structure–heap
Table of Contents 1. Concept 2. The three most important methods in the heap 3. Big top pile 4. Implementing a large top heap based on arrays 5. Heap sort 6. Small top pile 7. Implement small top heap based on array 8.ProiorityQueue and Heap Example: 9. Find the Kth largest element in the array […]
[Data Structure] Heap sorting and top-K problem
Heap implementation source code #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <time.h> #include <stdbool.h> #include <assert.h> typedef struct Heap {<!– –> int* a; int size; int capacity; }Heap; void HeapInit(Heap* st) {<!– –> st->a = NULL; st->capacity = 0; st->size = 0; } void swap(int* str1, int* str2) {<!– –> int tmp = *str1; *str1 […]
[TopK problem] Heap-based method & divide-and-conquer strategy-based method
Description: TopK problem: For a given array, select the largest/smallest k elements, or select the kth largest/kth smallest element; This article summarizes two implementation methods, namely Heap-based implementation method: Different from heap sorting, only by constructing a heap containing k elements, the largest/minimum k elements are finally obtained. Method based on divide and conquer strategy: […]
Data structure-binary tree·heap (implementation of sequential structure)
Personal business card: About the author: A sophomore student who is willing to share what he has learned on the road of study. Personal homepage: GOTXX Personal WeChat: ILXOXVJEThis article is original by GOTXX and first published on CSDN Column series: Learning C language from scratch —– The road to learning data structuresWord of the […]
What a trap! Spring Boot caused an off-heap memory leak!
Hello everyone, I am Bucai Chen~ In order to better manage the project, we migrated a project in the group to the MDP framework (based on Spring Boot), and then we found that the system frequently reported exceptions about excessive Swap area usage. The author was called to help check the cause and found that […]
Design and analysis of computer algorithms – data structures (tables, queues, heaps, stacks, sets, graphs, trees)
Simply put Data structures are essential tools in computer science for organizing and manipulating data efficiently. In this blog post, we will discuss the design principles and concepts behind the following data structures: tables, queues, stacks, sets, graphs, and trees. Tables: Tables, also known as arrays or matrices, are one of the simplest and most […]
Why does Java NIO cause off-heap memory OOM?
Why does Java NIO cause off-heap memory OOM? Description One day, an alarm was issued: a service deployed on a certain machine was suddenly inaccessible. Remember to log in to the machine and check the logs as the first reaction, because the service is down, most likely due to OOM. At this time, the following […]
Data structure – (heap) PriorityQueue
Table of Contents Preface 1. What is a heap? 1.1 Heap storage method 2. Creation of heap 2.1: We build the heap using the downward adjustment method: 2.2: Time complexity of building a heap Three: Heap method 3.1: Insertion into the heap 3.2: Deletion of heap Four: Use heap simulation to implement priority queue Summarize […]