Go transformation-Data structure Beginner (ii)

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed. **1**. Linear structure is characterized by a non-empty finite set of data elements: * * (1) * *. There is only one data element called "First" * * (2) * *. There is only one data element called "Last" * * (3) * *. In addition to the first element, all other data elements in the collection have only one precursor * * (4) * *. In addition to the last element, all other data elements in the collection have only one successor **2**. Linear table Linear table is the most common and simplest kind of data structure, in short, a linear table is a finite sequence of n data elements, as each element has different meanings, it may be a number or more complex information. In a slightly more complex linear table, a data element can consist of several data items, in which case we call the data element "* * * * *" and call the Linear table "* * file * *". Daily picture top thousand words:! [Image.png] (Https://static.studygolang.com/180120/a37406fca1cb339e70458067718b01a3.png) The number of elements in the linear table N (n>=0) is the length of the linear table, and the empty table when n=0 , in a non-empty table, each element has a fixed position. Linear tables are quite flexible to use, and their lengths can be increased or shortened depending on demand. The abstract data type linear table is defined as follows:! [Image.png] (https://static.studygolang.com/180120/7c129086f2bf8e42329686efa05cfdbb.png)! [Image.png] (https://static.studygolang.com/180120/9fea73dd8dadd2a37271dc2d4783bdf6.png)! [Image.png] (https://static.studygolang.com/180120/7284869abd70d789c8256f716f4d53ab.png) The abstract data type linear table defined above can perform some more complex operations, For example, merge two linear tables, split a linear table into two, or copy a linear table. The examples in the book want to use the go language way to solve, examples are as follows:! [Image.png] (https://static.studygolang.com/180120/0290b428e2815bbfa74dd584f1d5699b.png) The slice in the go language has no insertion method, the only thing that can be thought of is La = Append(LA,LB), and then bubble sort, do not know if anyone can point out, whether there is a better way to solve. 259 reads  

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.