Simple double linked list problem
You cannot submit for this problem because the homework's deadline is due.
Follow the starter files released on canvas.
All you need to do is submit a double_list.c file into a zip file(it should add #include"double_list.h" at first few lines)
#ifndef LAB8NEW_DOUBLE_LIST_H
#define LAB8NEW_DOUBLE_LIST_H
typedef struct node{
int data;
// the next node and the previous node
struct node *next;
struct node *prev;
}node_t;
void push(node_t **head_ref,int num);
void insertAfter(node_t* prev_node, int num);
void append(node_t ** head_ref, int new_data);
void printList(node_t* node);
void deleteNode(node_t ** head_ref, node_t * del);
void freeList(node_t **head_ref);
#endif //LAB8NEW_DOUBLE_LIST_H
A sample double_list.c file:
//
// Created by Dell on 2020/7/3.
//
#include "double_list.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void push(node_t **head_ref,int num){
//TODO: head reference is the reference to the node head, push one element to the linklist
//Hint: notice if no element exist in double linked list
}
void deleteNode(node_t ** head_ref, node_t * del)
{
//TODO: Implement function to delete a node in a Doubly Linked List.
// head_ref --> pointer to head node pointer.
// del --> pointer to node to be deleted
}
void insertAfter(node_t *prev_node, int num){
//TODO: Insert List node after a given node.
}
void append(node_t ** head_ref, int new_data)
{
//Given a reference (pointer to pointer) to the head of a DLL and an int, appends a new node at the end
}
void printList(node_t* node)
{
printf("\nVisit Elements in forward direction \n");
while (node != NULL) {
printf(" %d ", node->data);
node = node->next;
}
}
void freeList(node_t **head_ref){
// TODO: Free the list
}