Informações

Autores Jean-Luc Bibaud Anthony Doeraene
Prazo de entrega Sem prazo
Limite de submissão No limitation

Etiquetas

Entrar

Reverse

In this exercice you are asked to implement a function to reverse a given linked list. So for example if your input is a list in the form a->b->c, your output should be c->b->a. You can implement this with recursion if you so desire.

You have a linked list composed of nodes.

typedef struct node{
    int val;
    struct node *next;
} node_t;

Questão 1: Reverse
/*
* Reverses linked list
*
* pre         : head will not be null
*
* @return     : the head of the list reversed
*               NULL if a malloc fails
*/
node_t* reverse(node_t* head){
Questão 2: Auxiliary functions

Write here your auxiliary functions