ECE 2036 Project

Dependencies:   mbed wave_player 4DGL-uLCD-SE

doublely_linked_list.cpp

Committer:
rconnorlawson
Date:
2017-11-03
Revision:
0:cf4396614a79
Child:
2:2042f29de6b7

File content as of revision 0:cf4396614a79:

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

DLinkedList* create_dlinkedlist(void) {
    DLinkedList* newList = (DLinkedList*)malloc(sizeof(DLinkedList));
    newList->head = NULL;
    newList->tail = NULL;
    newList->current = NULL;
    newList->size = 0;
    return newList;
}

LLNode* create_llnode(void* data) {

    // Your code here
    return NULL;

}


void insertHead(DLinkedList* dLinkedList, void* data){
  LLNode* newNode = create_llnode(data);
  if(dLinkedList->head == NULL){
    dLinkedList->size++;
    dLinkedList->head = newNode;
    dLinkedList->tail = newNode;
  }else{
    dLinkedList->size++;
    newNode->next = dLinkedList->head;
    (dLinkedList->head)->previous = newNode;
    dLinkedList->head = newNode;
  }
}


void insertTail(DLinkedList* dLinkedList, void* data){

    // Your code here

}

int insertAfter(DLinkedList* dLinkedList, void* newData){

    // Your code here
    return 0;

}

int insertBefore(DLinkedList* dLinkedList, void* newData){

    // Your code here
    return 0;

}


void* deleteBackward(DLinkedList* dLinkedList){

    //Your code here.
    return NULL;

}



void* deleteForward(DLinkedList* dLinkedList){

    //Your code here.
    return NULL;

}


void* removeBackward(DLinkedList* dLinkedList){

    //Your code here.
    return NULL;

}

void* removeForward(DLinkedList* dLinkedList){

    //Your code here.
    return NULL;

}


void destroyList(DLinkedList* dLinkedList){
  if(dLinkedList->head != NULL){
    getHead(dLinkedList);
    while(deleteForward(dLinkedList)){};
  }
  free(dLinkedList);
}


void* getHead(DLinkedList* dLinkedList){

    //Your code here.
    return NULL;

}



void* getTail(DLinkedList* dLinkedList){

    //Your code here.

    return NULL;
}



void* getCurrent(DLinkedList* dLinkedList){

    //Your code here.
    return NULL;

}



void* getNext(DLinkedList* dLinkedList){

    //Your code here.

    return NULL;
}



void* getPrevious(DLinkedList* dLinkedList){

    //Your code here.

    return NULL;
}


int getSize(DLinkedList* dLinkedList){

    //Your code here.
    return 0;

}