Circular Doubly Linked List Binary Heap Data Sorting
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing data sorting method based on a binary heap with a pointer chain has high time complexity for locating the tail node, leading to high time complexity in adding or deleting operations.
Innovation Solution
A data sorting method using a circular doubly linked list to rapidly locate the cursor node, determining the node to be updated based on the update type, and performing updating and sorting operations efficiently.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Stability of the object's composition
If a pointer chain based binary heap is used for data sorting, then the data structure can maintain a complete binary tree structure, but the time complexity of locating the tail node becomes high
Solution Approach 1:
The patent segments the binary heap structure by introducing a circular doubly linked list that connects all leaf nodes. This segmentation allows independent access to leaf nodes without traversing from the root, resolving the contradiction between maintaining binary tree structure and enabling efficient tail node location.
Solution Approach 2:
The patent introduces a circular doubly linked list as an intermediary structure between the binary heap nodes. This intermediary provides direct access paths to leaf nodes, eliminating the need for step-by-step traversal from the root node while preserving the original binary heap structure.
2Stability of the object's composition
If step-by-step traversal from root node is used to locate tail node, then the binary heap structure is maintained, but the time complexity of adding or deleting operations becomes high
Solution Approach 1:
The patent segments the binary heap by creating a separate circular doubly linked list structure that connects all leaf nodes. This allows O(1) access to the tail node for deletion operations and efficient access to leftmost leaf nodes for insertion operations, dramatically improving productivity while maintaining the binary heap structure.
Solution Approach 2:
The patent performs preliminary action by pre-establishing the circular doubly linked list structure during heap construction. This preliminary setup enables direct access to tail nodes and leaf nodes during adding or deleting operations, eliminating the need for time-consuming traversals and significantly improving operational efficiency.
3Loss of time
If a circular doubly linked list is introduced to rapidly locate cursor node, then the time complexity of updating and sorting operations is reduced, but the device complexity increases
Solution Approach 1:
The patent merges the binary heap structure with a circular doubly linked list structure, where the linked list nodes reuse the same data structures as the binary heap nodes. This merging approach reduces the overhead of maintaining separate structures and minimizes the increase in device complexity while achieving O(1) access to cursor nodes.
Data Source
AI summary
A data sorting method, apparatus and device, a storage medium, and a program product. The method includes: obtaining a data sorting and updating request, where the data sorting and updating request includes data to be updated and an update type; determining a current cursor node, according to the data sorting and updating request, from a circular doubly linked list corresponding to a binary heap storing original data and according to pointing of the current cursor node pointer; determining a node to be updated corresponding to the data to be updated in the binary heap according to the update type and the current cursor node; and performing updating and sorting operations on the original data according to the node to be updated and the data to be updated.


