13702 - EE2310_Lec_9_1   

Description

/* ---    DO NOT SUBMIT main() !!!   --- */

/* --- submit EVERYTHING ELSE except main() --- */

/* --- containing the #include directives and struct definition --- */

 

#include <stdio.h>
#include <stdlib.h>


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

typedef struct linked_list {
    node_t *head;
    node_t *tail;
} linked_list_t;

void initialize(linked_list_t *list_ptr) {
    list_ptr->head = NULL;
    list_ptr->tail = NULL;
}

void output_list(linked_list_t *ptr_list) {
/*
 * Use your code for Lecture 8-2
 */
}

void add_node(linked_list_t *list_ptr, int data) {
/*
 * Use your code for Lecture 8-2
 */
}

node_t* find_middle(linked_list_t *list_ptr) {
/*
 * Your code here
 */
}

void free_list(linked_list_t *ptr_list) {
/*
 * Your code here.
 * You should return the memory for each node in the list using a loop.
 */
}

Input

8
1 2 3 4 5 6 7 8

 

Output

mid = 5

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

13702.c

Partial Judge Header

13702.h

Tags




Discuss