Thinking of data structure __ data structure

Source: Internet
Author: User

After completing the course of a semester's data structure, there is some understanding of the data structure. In a word, I know more about data structure and the importance of data structure than when I just learned it.
The data structure, as its name suggests, is a course of discussion of the structure of the information, and at first our teacher told us that the writing program consists of the following aspects: Abstract data Type description (in reality programming is almost impossible to be a simple data type, so the need for artificial abstraction) data manipulation (code implementation)

The main purpose of data structure is the first: the description of the abstract data type.

Defined:
A data structure is a specialized format for organizing and storing data. General data structure types include the array, the file, the record, the table, the tree, and the. Any data structure are designed to organize data to suit a specific purpose so this it can be, accessed and worked with in a Ppropriate ways. In computer programming, a data structure could selected or designed to store data for the purpose of working on it with Various algorithms.

Translation:
A data structure is a special type designed to manipulate and store data. Generally speaking, data structures include arrays, files, records, tables, trees, and so on. The purpose of any data structure design is to make the data meet the specific requirements so that it can perform well without error; in computer programming, a data structure is selected or the purpose of the design may be to implement an algorithm well.

In summary, the purpose of data structure: to store and facilitate the operation of a specially designed data structure for an algorithm

The following is the construction code for my Haffman tree, although there are some bugs but for the first time I have a deep understanding of the importance of data structures.
GitHub Address

Binarynode is a two-fork tree node data structure
struct Binarynode {
    int val;
    binarynode* Lc=null;
    binarynode* rc=null;
};
Linknode
struct Linknode {
    int val) storing the original node information by the linked list method;
    linknode* Next=null;
    binarynode* p = NULL;
The function class
Haff {public
:
    linknode* linkroot    Haffman class; The root node of Linknode
    binarynode* binaryroot;    The root node of the tree after the spanning tree is public
:
    Haff (int[]);   Constructor
    void Viewlink ();   View the build completed link
    int linklength ();    Get link's length
    void Deletebinary (binarynode*);    Deletes a binary tree for destructors to invoke
    void Deletelinknode (linknode*);    Delete Linknode for destructor call
    linknode* Min ();    Find the smallest node
    linknode* Pre (linknode*);    Looking for the first node
    void InLink (linknode*) of the specified node;    into the link
    void Build ();    The whole construction function
    void PreView (binarynode*);    View the construction completed Huffman Tree
    ~haff ();    destructor
};

Sentiment:
in the construction of Huffman tree to really know the importance of data structure: sometimes there is a choice is not a good thing, I started to use array storage nodes, but not dynamic search; The list also has to be judged by the state and sometimes it appears in a function where the requested space cannot be returned by a bug. This thing gives me a new understanding of the data structure.

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.