![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
baseline features - a little buggy
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
Diff: doubly_linked_list.cpp
- Revision:
- 0:95264f964374
- Child:
- 1:4421c1e849e9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doubly_linked_list.cpp Mon Mar 29 21:17:26 2021 -0400 @@ -0,0 +1,127 @@ +//================================================================= +// Implementation for DLL module. +// +// Copyright 2021 Georgia Tech. All rights reserved. +// The materials provided by the instructor in this course are for +// the use of the students currently enrolled in the course. +// Copyrighted course materials may not be further disseminated. +// This file must not be made publicly available anywhere. +//================================================================= +#include <stdlib.h> +#include <stdio.h> +#include "doubly_linked_list.h" + +LLNode* create_llnode(void* data) { + + // Your code here + + return NULL; // replace this +} + +DLinkedList* create_dlinkedlist(void) { + DLinkedList* newList = (DLinkedList*)malloc(sizeof(DLinkedList)); + newList->head = NULL; + newList->tail = NULL; + newList->size = 0; + return newList; +} + +int getSize(DLinkedList* dLinkedList){ + + // Your code here + + return 0; +} + +LLNode* getHead(DLinkedList* dLinkedList){ + + // Your code here + + return NULL; // replace this +} + +LLNode* getTail(DLinkedList* dLinkedList){ + + // Your code here + + return NULL; // replace this +} + +LLNode* getNext(LLNode* node){ + + // Your code here + + return NULL; // replace this +} + +LLNode* getPrev(LLNode* node){ + + // Your code here + + return NULL; // replace this +} + +void* getData(LLNode* node){ + + // Your code here + + return NULL; // replace this +} + +void insertAfter(DLinkedList* dLinkedList, LLNode* prev_node, void* data){ + if (prev_node == NULL) { + printf("the given previous node cannot be NULL"); + return; + } + + // Your code here + + return; +} + +void insertBefore(DLinkedList* dLinkedList, LLNode* next_node, void* data){ + if (next_node == NULL) { + printf("the given next node cannot be NULL"); + return; + } + + // Your code here + + return; +} + +void insertHead(DLinkedList* dLinkedList, void* data){ + if(dLinkedList->head == NULL){ + LLNode* newNode = create_llnode(data); + dLinkedList->head = newNode; + dLinkedList->tail = newNode; + dLinkedList->size++; + }else{ + insertBefore(dLinkedList, dLinkedList->head, data); + } +} + +void insertTail(DLinkedList* dLinkedList, void* data){ + + // Your code here + +} + +void deleteNode(DLinkedList* dLinkedList, LLNode* Node){ + + // Your code here + +} + +void destroyList(DLinkedList* dLinkedList){ + + // Your code here + +} + +void reverse(DLinkedList* dLinkedList) +{ + + // Your code here + +}