Current location - Loan Platform Complete Network - Big data management - What is a heap?
What is a heap?
A heap is usually an array object and can be regarded as a tree. Heaps always satisfy the following properties:

The value of a node in 1 heap is never greater than or less than the value of its parent node;

2 heap is always a complete binary tree.

The heap with the largest root node is called the largest heap or big root heap, and the heap with the smallest root node is called the smallest heap or small root heap. Common piles are binary pile, Fibonacci pile and so on.

The implementation of extended data heap is a binary tree, which is realized by constructing binary heap. Because of its extensive application, when unlimited, it refers to the realization of data structure. This data structure has the following properties. Any node is less than (or greater than) all its descendants, and the smallest element (or the largest element) is at the root of the heap (heap sorting).

A heap is always a complete tree. That is, except the bottom layer, the nodes of other layers are filled with elements, and the bottom layer is filled from left to right as much as possible.

The basic characteristics of stack: first in, then out, then in, first out. Except for the head node and the tail node.