Can anyone give a C based merge sorting method, preferably with an example ha10

Updated on technology 2024-05-10
6 answers
  1. Anonymous users2024-02-10

    No, in fact, the basic structure of C language is not necessarily limited to the sequential structure, the selection structure, and the loop structure, as long as it has the four common characteristics of the basic structure, it can be used as the basic structure.

    The common features of the basic structure are:

    1) There is only one entrance;

    2) There is only one exit for the cave closure;

    3) every part of the structure has the opportunity to be executed;

    4) There is no dead loop within the structure.

    The sequential structure, the selection structure, and the cyclic structure all meet the above four characteristics and are used as the basic units to represent a good algorithm.

    Extended Materials. There are two common cyclic structures:

    1. Current-type cycle: first judge whether the given condition p is true, if p is true, then execute a (step); then judge whether condition p is true; If p is true, then a is executed, and this is repeated until a certain condition p is not true.

    2. Until the type cycle: first execute a, and then quietly judge whether the given condition p is true, if p is not true, then execute a, and so on, until p is established, the cycle process ends and starts the tremor macro.

    Author of Tsinghua University Press.

    Chapter 2. The soul of the program - the algorithm.

    How to represent an algorithm.

  2. Anonymous users2024-02-09

    Yes. For example, C language is a structured language, and C language has three structures: sequential structure, selection structure, and circular structure.

    The cyclic structure also contains the current type cycle and the until type cycle:

    1. Current-type cycle: judge first, then execute. Perform at least 0 times.

    2. Until the type cycle: execute first, then judge. Perform at least 1 attempt.

    Extended information: Structural Visits to the Oak Circle Asks the Difference.

    According to the different types of struct variables, there are generally two access methods, one is direct access and the other is indirect access.

    Direct access to struct variables that apply to normal, and indirect access to pointers that point to struct variables. Direct access uses struct variable names. Member's name, indirect access is used (*struct pointer name).

    Member name or use struct pointer name - > member name. The same member name is distinguished by different variable prefixes.

  3. Anonymous users2024-02-08

    Previous lab questions.

    #define ok 1

    #define null 0

    #define error 2

    #define elemtype int

    #include ""

    #include ""

    #include ""

    typedef struct lnode

    lnode,*linklist;

    linklist createlist_l(linklist l, int n)

    Create a singly linked list.

    return l;

    int print( linklist l) output linked list}else

    cout<<"There is no data in the linked list"j=0;

    while(p!=null)

    return j;

    int cleatlist l(linklist l) to clear the linked list element.

    cout<<"The data has been emptied"Look for the i-1st node.

    if (!p||j > i-1)

    return error;i is greater than the table length or less than 1s=(linklist)malloc(sizeof(lnode));

    s->data = e;

    s->next = p->next;Insert p-> next = s in l;

    return ok;

    In a single-linked list linear table l with a leading node, the i-th element is deleted and the head pointer of the linked list whose value is the leading node is returned by e.

    When the ith element exists, its value is assigned to e and returns ok, otherwise errorif(!) is returnedp||j>i)return error;The i-th element does not exist.

    e=p->data;get the ith element return e;

    void showmenu()}

  4. Anonymous users2024-02-07

    Decimals are stored in binary, that is to say, decimals are calculated by 2 (minus 1 power) + 2 (minus 2 power) + 2 (minus 3 power) +. 2 (negative n power) The larger n is, the more accurate it is.

    The corresponding binary number is.

    And the decimal number corresponding to this binary number is.

    Due to the accuracy problem, it was rounded, that is, the following 09997 became 1 digit, so it is, the decimal and the binary number do not correspond one-to-one.

  5. Anonymous users2024-02-06

    In the computer, float is expressed by the decimal floating-point number, and the conversion of decimal to binary will have an error, and then turn it back and see this error.

  6. Anonymous users2024-02-05

    Merging is the process of combining multiple sorted sequences into an ordered sequence. Merging two ordered sequences into one ordered sequence is called merge. Merge sorting is to use merge technology to sort, and the merging of two pairs finally becomes an ordered sequence.

Related questions
4 answers2024-05-10

The most classic textbook for the C language is Brian WThe C Programming Language, co-authored by Kernighan and Dennies. One of the authors (Dennies) is the father of the C language. >>>More

8 answers2024-05-10

What does it mean to pay every day?

4 answers2024-05-10

Think about what you're ignoring in your daily life? In fact, everyone ignores many things, and what is overlooked is often those things that are warm and small that are taken for granted. >>>More

6 answers2024-05-10

Qu yuan. Qu Yuan (c. 340 B.C., c. 277 B.C.).

Mingping, also known as Zhengzheng, the word Lingjun, the Chu people during the Warring States Period. It is said to be a native of Zigui, Hubei. Born in the aristocracy, he was a left-handed disciple and a doctor in Sanlu, and when he was pregnant with the king, he advocated joining forces to resist Qin and choosing meritocracy, but he was excluded by the nobles and was useless, and was slandered by Jin Shang and others, and was exiled to Hanbei, so he wrote "Lisao" to show his loyalty; King Qingxiang was recalled, and was exiled to Jiangnan by the advice of Shangguan Doctor, and finally because he couldn't bear to see the country fall, Huaishi sank into the Miluo River and died. >>>More

20 answers2024-05-10

I'll play it for you, Shadow Island, because the ranking points are down, I'll change the district, but you can only play Shadow Island, there are 5 or 50 heroes in it that you can practice.