7. Organization of Group and group data-1. function templates and class templates

Source: Internet
Author: User

The basic data type is predefined by the C + + compilation system, and the data for the custom type is made up of multiple primitive types or elements of a custom type, which we call group data.

For group data, only system-predefined operations are not enough, and in many cases it is necessary to design special operations related to specific problems, and to encapsulate data and operations in an object-oriented way, which is a group class .

Groups can be divided into two types: linear and nonlinear groups. Elements in a linear group are ordered by position. Non-linear populations identify elements without positional order.

The organization of group data belongs to the data structure category, here only two kinds of commonly used algorithms: sorting and finding methods.

Sorting: Also known as classification or collation, is the process of adjusting an unordered sequence to an orderly one. There are two basic operations that need to be done during sorting: one is to compare the size of two numbers, but to adjust the position of the elements in the sequence. Sort by: Direct insert sort, direct select sort and bubble sort.

Find: Is the process of finding the specific data element that is needed in a sequence in a certain way. Methods: Sequential lookup, binary lookup.

1.

7. Organization of Group and group data-1. function templates and class templates

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.