8-4-storage compression-Dynamic Storage Management-Chapter 8th-Data Structure textbook source code-yan Weimin Wu Weimin edition, 8-4-Data Structure

Source: Internet
Author: User

8-4-storage compression-Dynamic Storage Management-Chapter 8th-Data Structure textbook source code-yan Weimin Wu Weimin edition, 8-4-Data Structure

Textbook source code

Chapter 4 Dynamic Storage Management-storage tightening

-- Data Structure-yan Weimin. Wu Weimin

Source code instructions☛☛☛Data Structure-C language version (Yan Weimin, Wu Weimin version) Textbook source code + EXERCISE set parsing instructions

Textbook source code compilation Link☛☛☛Data Structure textbook source code compilation

Question set full resolution Link☛☛☛Analysis and compilation of data structure question set

 

File links introduced in this source code☛Status. h

Test data download link☛Data Packets

 

Source code and test data storage directory in the document: Data Structure \ ▲textbook Algorithm Implementation \ ▲08 Dynamic Storage Management \ 04 StorageCompacting

 

Overview

Storage compression is a dynamic storage management method in the heap structure.

In the entire dynamic storage process, the space that can be used at any time is a sequential address storage zone, which is called "Heap" in the Compilation Program ", each allocation is to draw a piece from the available space. The implementation method is to set up a heap pointer, which is called a heap pointer and always points to the lowest (or highest) Heap address. When a user applies for N storage blocks, the heap pointer calls N storage units to the high address (or low address, the value of the heap pointer before moving is the initial address of the occupied block allocated to the user.

Otherwise, when you need to recycle idle blocks from users, because the space available by the system is always an address for sequential storage, therefore, the released idle blocks must be merged into the whole heap for reuse during recycling. This is the "Storage compression" task.

Analysis

There are usually two ways to tighten storage. One is to compress storage blocks once a user releases them, and the other is to release them at any time during program execution, storage tightening is not performed until the available space is insufficient or the heap Pointer Points to the highest address. At this time, the purpose of the compression is to connect all the space blocks in the heap into a single block so that all the occupied blocks are concentrated in the low address area of the available space, the remaining high address area becomes a continuous idle block of the whole address.

Source code File 1☛StorageCompacting. h

 

File 2☛StorageCompacting. c

 File 3☛StorageCompacting-main.c (test documentation)

 Test Result Display

 

Updating more chapters...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.