---
# System prepended metadata

title: 13826 - The Missing eForms
tags: [linked list]

---

# 13826 - The Missing eForms
>author: Utin
###### tags: `linked list`
---

## Brief
See the code below

## Solution 0

```c=
#include <stdio.h>
#include <stdlib.h>

typedef struct _Node {
    int serial, stu_id;
    char name[1001]; 
    struct _Node* next;
} Node;

void eFormSort(Node *head) {
    Node* curr = head, * pre_curr, * tail = head;

    // count the length
    int len = 0;
    while (curr) {
        len++;
        curr = curr->next;
    }

    for (int i = 2; i <= len; i++) {

        // search
        curr = tail->next;
        pre_curr = tail;
        while (curr->serial != i) {
            pre_curr = curr;
            curr = curr->next;
        }

        // connect
        pre_curr->next = curr->next;
        curr->next = tail->next;
        tail->next = curr;

        // update
        tail = tail->next;
    }
}

// By Utin
```

## Reference