This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
user:jr018429:portfolio:libdll [2011/11/03 12:37] – [Project: Doubly Linked List Library Implementation] jr018429 | user:jr018429:portfolio:libdll [2011/11/04 14:38] (current) – [Code] jr018429 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Project: | ||
+ | A project by John T. Rine (jr018429) for CSCS2320-Data Structures during the Fall 2011 semester. | ||
+ | My linked list library is available for download from: | ||
+ | http:// | ||
+ | \\ | ||
+ | Originally, I expected this project to take two weeks but it is now week 6 and I am just finishing it up. It didn't take me 6 weeks to do the linked list, I started working on a stack library project, but after the instructor told me he would prefer a linked list implementation of a stack library rather than an array-based one, I changed gears and began working on the linked list instead and I am glad I did! The linked list, while a data structure in and of itself, can be or is the basis for other data structures such as stacks and trees. | ||
+ | Besides learning about linked lists and doubly linked lists in particular. I learned about and gained experience working with pointers to pointers, structures, pointers to structures, dereferencing pointers to structures, dereferencing pointers to pointers to structures, and creating and using a static library. | ||
+ | =====Objectives===== | ||
+ | The purpose of this project was to create a static doubly linked list library and use it with a test program to verify the library.\\ Since linked lists are used to implement other data structures, I suspect this library will be used in other data structure projects.\\ | ||
+ | =====Prerequisites===== | ||
+ | In order to successfully accomplish/ | ||
+ | * understand and use the C/C++ programming language | ||
+ | * understand and use functions | ||
+ | * understand and use pointers in general | ||
+ | * understand and use pointers to pointers | ||
+ | * understand and use structs | ||
+ | * understand and use pointers (referencing and dereferencing) to structures | ||
+ | * understand and use pointer to pointers (refeencing and dereferencing) to structures | ||
+ | * understand and use malloc() to dynamically allocate memory | ||
+ | * understand and use free() to deallocate memory | ||
+ | * understand the linked data structure (singly and doubly linked lists) in general | ||
+ | * know how to create and use a static library | ||
+ | * know how to build a doubly linked list library using the items listed above | ||
+ | =====Background===== | ||
+ | Originally, I was working on a stack data structure library, however, I was going to implement an array-based stack. The instructor wanted me to implement the stack library using a linked list rather than using an array so I backed up and created a linked list library first. I will then use the linked list library to implement a stack library. | ||
+ | =====Scope===== | ||
+ | To better utilize the functionality of the doubly linked list we've been studying in class, a personal implementation for use as a library will be undertaken for use in other projects and activities this semester. | ||
+ | |||
+ | Working from the class example, a library implementation will be created which has the following functions: | ||
+ | |||
+ | * **create**: generate a new node | ||
+ | * **append**: add a new node to the list after a given node | ||
+ | * **remove**: remove a node from the list | ||
+ | * **search**: find if a node exists (likely search by value) | ||
+ | * **insert**: add a new node to the list before a given node | ||
+ | * **delete**: destroy/ | ||
+ | * **copy**: duplicate an existing list | ||
+ | |||
+ | Creating a header file will be in order, which will contain the function prototypes of all of the above. The code will be implemented across several files (create.c, add.c, delete.c, process.c, or however you wish to structure it-- have at least 4 .c or .cc source files). | ||
+ | |||
+ | There will also be a sample implementation (ie a file with a **main()**) that will include the header file and demonstrate this library being created (it will link against it to compile). | ||
+ | |||
+ | =====Attributes===== | ||
+ | The course requirement for Data Structures projects are listed at:\\ | ||
+ | http:// | ||
+ | This project has the following project attributes described on that page: | ||
+ | ^Attribute^Qty Needed^Description^ | ||
+ | |Pointers|8|Indirection/ | ||
+ | |malloc/ | ||
+ | |Linked lists|2|Implementation/ | ||
+ | |Doubly Linked lists|4|Implementation/ | ||
+ | |Libraries|4|Implementation/ | ||
+ | \\ | ||
+ | This project, therefore, is eligible for 22 attributes, however, only 6 of these are achieveable per project, so project far exceeds the minimum attribute requirements. | ||
+ | =====Code===== | ||
+ | My library is composed of the following files and functions: | ||
+ | **linkedListLib.h**\\ | ||
+ | linkedListLib.h is the header file for the linked list library. It should be included in any .c library files whose function prototypes have been added to it. Also, it must be added to any programs utilizing the library' | ||
+ | Example code:\\ | ||
+ | <file h linkedListLib.h> | ||
+ | // | ||
+ | //John T. Rine | ||
+ | //October 5, 2011 | ||
+ | |||
+ | #ifndef _LINKEDLIST_JR_H | ||
+ | #define _LINKEDLIST_JR_H | ||
+ | |||
+ | # | ||
+ | # | ||
+ | |||
+ | struct Node | ||
+ | { | ||
+ | int data; | ||
+ | struct Node * prev; | ||
+ | struct Node * next; | ||
+ | }; | ||
+ | |||
+ | typedef struct Node node; | ||
+ | |||
+ | // | ||
+ | void createList(node **, node **, int); | ||
+ | void destroyListHead(node *); | ||
+ | void destroyListTail(node *); | ||
+ | int listSizeHead(node *); | ||
+ | |||
+ | // | ||
+ | int listSizeTail(node *); | ||
+ | void printIntDataHead(node *); | ||
+ | void insert(node **, node **, int, int); | ||
+ | |||
+ | // | ||
+ | void append(node **, node **, int, int); | ||
+ | void deleteNode(node **, node **, int); | ||
+ | void loadListData(node *); | ||
+ | |||
+ | // | ||
+ | void loadNode(node *, int, int); | ||
+ | void createNode(node*, | ||
+ | void copyList(node *, node **, node **); | ||
+ | int findData(node *, int); | ||
+ | |||
+ | #endif | ||
+ | </ | ||
+ | \\ | ||
+ | **linkedListLib1.c**\\ | ||
+ | <file c linkedListLib1.c> | ||
+ | // | ||
+ | //John T. Rine | ||
+ | //October 6, 2011 | ||
+ | |||
+ | //lab46:~$ gcc -c linkedListLib.c -o linkedListLib.o | ||
+ | //lab46:~$ ar crs liblinkedListLib.a linkedListLib.o | ||
+ | //lab46:~$ gcc -I. linkedListTest.c -o linkedListTest liblinkedListLib.a | ||
+ | |||
+ | # | ||
+ | # | ||
+ | //# | ||
+ | # | ||
+ | |||
+ | |||
+ | void createList(node **headd, node **taill, int elements) | ||
+ | { | ||
+ | int i; | ||
+ | node *new, *head, *tail; | ||
+ | new = head = tail = NULL; | ||
+ | |||
+ | for(i = 1; i< | ||
+ | { | ||
+ | if (head == NULL) | ||
+ | { | ||
+ | head = (node *) malloc(sizeof(node)); | ||
+ | tail = head; | ||
+ | head-> | ||
+ | head-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | new = (node *) malloc(sizeof(node)); | ||
+ | new-> | ||
+ | new-> | ||
+ | tail-> | ||
+ | tail = new; | ||
+ | } | ||
+ | } | ||
+ | *headd = head; | ||
+ | *taill = tail; | ||
+ | } | ||
+ | |||
+ | void destroyListHead(node *head) | ||
+ | { | ||
+ | node *temp; | ||
+ | node *temp2; | ||
+ | temp = NULL; | ||
+ | temp2 = NULL; | ||
+ | temp = head; | ||
+ | while(temp != NULL) | ||
+ | { | ||
+ | temp2 = temp-> | ||
+ | if (temp-> | ||
+ | if (temp-> | ||
+ | free(temp); | ||
+ | temp = temp2; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | void destroyListTail(node *tail) | ||
+ | { | ||
+ | node *temp; | ||
+ | node *temp2; | ||
+ | temp = NULL; | ||
+ | temp2 = NULL; | ||
+ | temp = tail; | ||
+ | while(temp != NULL) | ||
+ | { | ||
+ | temp2 = temp-> | ||
+ | if (temp-> | ||
+ | if (temp-> | ||
+ | free(temp); | ||
+ | temp = temp2; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int listSizeHead(node *head) | ||
+ | { | ||
+ | int size = 0; | ||
+ | while (head != NULL) | ||
+ | { | ||
+ | head = head-> | ||
+ | size++; | ||
+ | } | ||
+ | return size; | ||
+ | } | ||
+ | </ | ||
+ | \\ | ||
+ | **linkedListLib2.c**\\ | ||
+ | <file c linkedListLib2.c> | ||
+ | // | ||
+ | //John T. Rine | ||
+ | //October 6, 2011 | ||
+ | |||
+ | //lab46:~$ gcc -c linkedListLib.c -o linkedListLib.o | ||
+ | //lab46:~$ ar crs liblinkedListLib.a linkedListLib.o | ||
+ | //lab46:~$ gcc -I. linkedListTest.c -o linkedListTest liblinkedListLib.a | ||
+ | |||
+ | # | ||
+ | # | ||
+ | //# | ||
+ | # | ||
+ | |||
+ | int listSizeTail(node *tail) | ||
+ | { | ||
+ | int size = 0; | ||
+ | while (tail != NULL) | ||
+ | { | ||
+ | tail = tail-> | ||
+ | size++; | ||
+ | } | ||
+ | return size; | ||
+ | } | ||
+ | |||
+ | void printIntDataHead(node * head) | ||
+ | { | ||
+ | node * temp = NULL; | ||
+ | |||
+ | temp = head; | ||
+ | while(temp != NULL) | ||
+ | { | ||
+ | printf(" | ||
+ | temp = temp-> | ||
+ | } | ||
+ | printf(" | ||
+ | } | ||
+ | |||
+ | void insert(node ** head, node ** tail, int position, int data) | ||
+ | { | ||
+ | int i; | ||
+ | node *temp, *temp2; | ||
+ | temp = temp2 = NULL; | ||
+ | |||
+ | temp = *head; | ||
+ | for(i = 0; i < position; i++) | ||
+ | { | ||
+ | temp = temp -> next; | ||
+ | } | ||
+ | |||
+ | if (*head == NULL) | ||
+ | { | ||
+ | *head = (node *) malloc(sizeof(node)); | ||
+ | *tail = *head; | ||
+ | (*head)-> | ||
+ | (*head)-> | ||
+ | (*head)-> | ||
+ | } | ||
+ | else if (*head == temp) | ||
+ | { | ||
+ | temp2 = (node *) malloc (sizeof(node)); | ||
+ | temp2-> | ||
+ | (*head)-> | ||
+ | *head = (*head)-> | ||
+ | (*head)-> | ||
+ | (*head)-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | temp2 = (node *) malloc (sizeof(node)); | ||
+ | temp2-> | ||
+ | temp2-> | ||
+ | temp-> | ||
+ | temp-> | ||
+ | temp2-> | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | \\ | ||
+ | **linkedListLib3.c**\\ | ||
+ | <file c linkedListLib3.c> | ||
+ | // | ||
+ | //John T. Rine | ||
+ | //October 6, 2011 | ||
+ | |||
+ | //lab46:~$ gcc -c linkedListLib.c -o linkedListLib.o | ||
+ | //lab46:~$ ar crs liblinkedListLib.a linkedListLib.o | ||
+ | //lab46:~$ gcc -I. linkedListTest.c -o linkedListTest liblinkedListLib.a | ||
+ | |||
+ | # | ||
+ | # | ||
+ | //# | ||
+ | # | ||
+ | |||
+ | void append(node **head, node **tail, int position, int data) | ||
+ | { | ||
+ | int i; | ||
+ | node *temp, *temp2; | ||
+ | temp = temp2 = NULL; | ||
+ | |||
+ | temp = *head; | ||
+ | for(i = 0; i < position; i++) | ||
+ | { | ||
+ | temp = temp -> next; | ||
+ | } | ||
+ | |||
+ | if (*head == NULL) | ||
+ | { | ||
+ | *head = (node *) malloc(sizeof(node)); | ||
+ | *tail = *head; | ||
+ | (*head)-> | ||
+ | (*head)-> | ||
+ | (*head)-> | ||
+ | } | ||
+ | else if (*tail == temp) | ||
+ | { | ||
+ | temp2 = (node *) malloc (sizeof(node)); | ||
+ | temp2-> | ||
+ | temp2-> | ||
+ | (*tail)-> | ||
+ | *tail = temp2; | ||
+ | (*tail)-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | temp2 = (node *) malloc (sizeof(node)); | ||
+ | temp2-> | ||
+ | temp2-> | ||
+ | temp-> | ||
+ | temp-> | ||
+ | temp2-> | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | void deleteNode(node **head, node **tail, int position) | ||
+ | { | ||
+ | int i; | ||
+ | node * temp = NULL; | ||
+ | |||
+ | temp = *head; | ||
+ | for(i = 0; i < position; i++) | ||
+ | { | ||
+ | temp = temp-> | ||
+ | } | ||
+ | if(temp != *head && temp != *tail) | ||
+ | { | ||
+ | temp-> | ||
+ | temp-> | ||
+ | temp-> | ||
+ | temp-> | ||
+ | } | ||
+ | else if (temp == *head) | ||
+ | { | ||
+ | temp-> | ||
+ | *head = temp-> | ||
+ | temp-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | temp-> | ||
+ | *tail = temp-> | ||
+ | temp-> | ||
+ | } | ||
+ | free(temp); | ||
+ | } | ||
+ | |||
+ | void loadListData(node *head) | ||
+ | { | ||
+ | int i = 0; | ||
+ | node *temp = NULL; | ||
+ | temp = head; | ||
+ | printf(" | ||
+ | scanf(" | ||
+ | while(i != -1) | ||
+ | { | ||
+ | temp-> | ||
+ | temp = temp-> | ||
+ | if(temp == NULL) | ||
+ | { | ||
+ | printf(" | ||
+ | break; | ||
+ | } | ||
+ | printf(" | ||
+ | scanf(" | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | \\ | ||
+ | **linkedListLib4.c**\\ | ||
+ | <file c linkedListLib4.c> | ||
+ | // | ||
+ | //John T. Rine | ||
+ | //October 6, 2011 | ||
+ | |||
+ | //lab46:~$ gcc -c linkedListLib.c -o linkedListLib.o | ||
+ | //lab46:~$ ar crs liblinkedListLib.a linkedListLib.o | ||
+ | //lab46:~$ gcc -I. linkedListTest.c -o linkedListTest liblinkedListLib.a | ||
+ | |||
+ | # | ||
+ | # | ||
+ | //# | ||
+ | # | ||
+ | |||
+ | void loadNode(node *head, int position, int value) | ||
+ | { | ||
+ | int i; | ||
+ | node *temp = NULL; | ||
+ | temp = head; | ||
+ | |||
+ | temp = head; | ||
+ | for(i = 0; i < position; i++) | ||
+ | { | ||
+ | temp = temp-> | ||
+ | } | ||
+ | temp-> | ||
+ | } | ||
+ | |||
+ | void createNode(node* head, node* tail) | ||
+ | { | ||
+ | head = (node *) malloc(sizeof(node)); | ||
+ | tail = head; | ||
+ | head-> | ||
+ | head-> | ||
+ | } | ||
+ | |||
+ | void copyList(node *head, node **copyHead, node **copyTail) | ||
+ | { | ||
+ | node *new, *temp; | ||
+ | new = *copyHead = *copyTail = temp = NULL; | ||
+ | temp = head; | ||
+ | while(temp != NULL) | ||
+ | { | ||
+ | if (*copyHead == NULL) | ||
+ | { | ||
+ | *copyHead = (node *) malloc(sizeof(node)); | ||
+ | *copyTail = *copyHead; | ||
+ | (*copyHead)-> | ||
+ | (*copyHead)-> | ||
+ | (*copyHead)-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | new = (node *) malloc(sizeof(node)); | ||
+ | new-> | ||
+ | new-> | ||
+ | (*copyTail)-> | ||
+ | *copyTail = new; | ||
+ | (*copyTail)-> | ||
+ | } | ||
+ | temp = temp-> | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int findData(node *head, int data) | ||
+ | { | ||
+ | int counter = 0; | ||
+ | while(head != NULL) | ||
+ | { | ||
+ | if(head-> | ||
+ | counter++; | ||
+ | head = head-> | ||
+ | } | ||
+ | return counter; | ||
+ | } | ||
+ | </ | ||
+ | \\ | ||
+ | **linkedListTest.c**\\ | ||
+ | <file c linkedListTest.c> | ||
+ | // | ||
+ | //Author: John T. Rine | ||
+ | //Date: October 5, 2011 | ||
+ | |||
+ | |||
+ | #include " | ||
+ | |||
+ | int main(int argc, char **argv) | ||
+ | { | ||
+ | |||
+ | node *head, *tail, *copyHead, *copyTail, *temp; | ||
+ | head = tail = copyHead = copyTail = NULL; | ||
+ | |||
+ | int i = 1; | ||
+ | |||
+ | printf(" | ||
+ | createList(& | ||
+ | printf(" | ||
+ | printf(" | ||
+ | loadListData(head); | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | insert(& | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | insert(& | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | append(& | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | append(& | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | loadNode(head, | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | loadNode(head, | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | deleteNode(& | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | deleteNode(& | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | printf(" | ||
+ | deleteNode(& | ||
+ | printf(" | ||
+ | printIntDataHead(head); | ||
+ | copyList(head, | ||
+ | printf(" | ||
+ | printIntDataHead(copyHead); | ||
+ | printf(" | ||
+ | |||
+ | destroyListHead(head); | ||
+ | getchar(); //Holds the console window open on a Windows machine | ||
+ | } | ||
+ | </ | ||
+ | \\ | ||
+ | **makeLinkedList.bat**\\ | ||
+ | The Windows batch file makeLinkedList.bat automates, manufacture of all of the .o files, the creation of the static library file, compiling, linking, and execution of linkedListTest, | ||
+ | Example code:\\ | ||
+ | <file bat makeLinkedList.bat> | ||
+ | del *.o | ||
+ | del *.exe | ||
+ | del *.a | ||
+ | |||
+ | gcc -c linkedListLib1.c -o linkedListLib1.o | ||
+ | rem pause | ||
+ | gcc -c linkedListLib2.c -o linkedListLib2.o | ||
+ | rem pause | ||
+ | gcc -c linkedListLib3.c -o linkedListLib3.o | ||
+ | rem pause | ||
+ | gcc -c linkedListLib4.c -o linkedListLib4.o | ||
+ | rem pause | ||
+ | ar rcs libLinkedListdll.a *.o | ||
+ | rem pause | ||
+ | gcc -I. linkedListTest.c -o linkedListTest libLinkedListdll.a | ||
+ | rem pause | ||
+ | linkedListTest | ||
+ | pause | ||
+ | </ | ||
+ | \\ | ||
+ | **makeLinkedList.sh**\\ | ||
+ | The bash shell script file makeLinkedList.sh automates the manufacture of all of the .o files, the creation of the static library file, compiling, linking and execution of linkedListTest, | ||
+ | Example code:\\ | ||
+ | <file sh makeLinkedList.sh> | ||
+ | #!/bin/bash | ||
+ | |||
+ | |||
+ | gcc -c linkedListLib1.c -o linkedListLib1.o | ||
+ | gcc -c linkedListLib2.c -o linkedListLib2.o | ||
+ | gcc -c linkedListLib3.c -o linkedListLib3.o | ||
+ | gcc -c linkedListLib4.c -o linkedListLib4.o | ||
+ | ar rcs libLinkedListdll.a *.o | ||
+ | gcc -I. linkedListTest.c -o linkedListTest | ||
+ | ./ | ||
+ | </ | ||
+ | =====Execution===== | ||
+ | Creation and execution of the linkedListTest program (Windows): | ||
+ | <cli> | ||
+ | |||
+ | C: | ||
+ | Could Not Find C: | ||
+ | |||
+ | C: | ||
+ | Could Not Find C: | ||
+ | |||
+ | C: | ||
+ | Could Not Find C: | ||
+ | |||
+ | C: | ||
+ | .c -o linkedListLib1.o | ||
+ | |||
+ | C: | ||
+ | |||
+ | C: | ||
+ | .c -o linkedListLib2.o | ||
+ | |||
+ | C: | ||
+ | |||
+ | C: | ||
+ | .c -o linkedListLib3.o | ||
+ | |||
+ | C: | ||
+ | |||
+ | C: | ||
+ | .c -o linkedListLib4.o | ||
+ | |||
+ | C: | ||
+ | |||
+ | C: | ||
+ | ll.a *.o | ||
+ | |||
+ | C: | ||
+ | |||
+ | C: | ||
+ | t.c -o linkedListTest libLinkedListdll.a | ||
+ | |||
+ | C: | ||
+ | |||
+ | C: | ||
+ | Creating a list of 4 nodes... | ||
+ | Size of the list is: 4 | ||
+ | Load list data | ||
+ | Enter a value or -1 to quit: 1 | ||
+ | Enter a value or -1 to quit: 2 | ||
+ | Enter a value or -1 to quit: 3 | ||
+ | Enter a value or -1 to quit: 4 | ||
+ | List is full of data! | ||
+ | 1 2 3 4 | ||
+ | Inserting node 0 with data of 3200 before head node... | ||
+ | Size of the list is: 5 | ||
+ | 3200 1 2 3 4 | ||
+ | Inserting node with data of -3200 before tail node... | ||
+ | Size of the list is: 6 | ||
+ | 3200 1 2 3 -3200 4 | ||
+ | Appending node with data of 2300 after head node... | ||
+ | Size of the list is: 7 | ||
+ | 3200 2300 1 2 3 -3200 4 | ||
+ | Appending node with data of -2300 after tail node... | ||
+ | Size of the list is: 8 | ||
+ | 3200 2300 1 2 3 -3200 4 -2300 | ||
+ | Loading node 0 with data of 0... | ||
+ | Size of the list is: 8 | ||
+ | 0 2300 1 2 3 -3200 4 -2300 | ||
+ | Loading tail node with data of 255... | ||
+ | Size of the list is: 8 | ||
+ | 0 2300 1 2 3 -3200 4 255 | ||
+ | Deleting head node... | ||
+ | Size of the list is: 7 | ||
+ | 2300 1 2 3 -3200 4 255 | ||
+ | Deleting tail node... | ||
+ | Size of the list is: 6 | ||
+ | 2300 1 2 3 -3200 4 | ||
+ | Deleting node 2... | ||
+ | Size of the list is: 5 | ||
+ | 2300 1 3 -3200 4 | ||
+ | Size of the list is: 5 | ||
+ | 2300 1 3 -3200 4 | ||
+ | The node location of 3 is 2 | ||
+ | |||
+ | C: | ||
+ | Press any key to continue . . . | ||
+ | </ | ||
+ | \\ | ||
+ | Creation and execution of the linkedListTest program (Linux):\\ | ||
+ | <cli> | ||
+ | lab46: | ||
+ | Creating a list of 4 nodes... | ||
+ | Size of the list is: 4 | ||
+ | Load list data | ||
+ | Enter a value or -1 to quit: 1 | ||
+ | Enter a value or -1 to quit: 2 | ||
+ | Enter a value or -1 to quit: 3 | ||
+ | Enter a value or -1 to quit: 4 | ||
+ | List is full of data! | ||
+ | 1 2 3 4 | ||
+ | Inserting node 0 with data of 3200 before head node... | ||
+ | Size of the list is: 5 | ||
+ | 3200 1 2 3 4 | ||
+ | Inserting node with data of -3200 before tail node... | ||
+ | Size of the list is: 6 | ||
+ | 3200 1 2 3 -3200 4 | ||
+ | Appending node with data of 2300 after head node... | ||
+ | Size of the list is: 7 | ||
+ | 3200 2300 1 2 3 -3200 4 | ||
+ | Appending node with data of -2300 after tail node... | ||
+ | Size of the list is: 8 | ||
+ | 3200 2300 1 2 3 -3200 4 -2300 | ||
+ | Loading node 0 with data of 0... | ||
+ | Size of the list is: 8 | ||
+ | 0 2300 1 2 3 -3200 4 -2300 | ||
+ | Loading tail node with data of 255... | ||
+ | Size of the list is: 8 | ||
+ | 0 2300 1 2 3 -3200 4 255 | ||
+ | Deleting head node... | ||
+ | Size of the list is: 7 | ||
+ | 2300 1 2 3 -3200 4 255 | ||
+ | Deleting tail node... | ||
+ | Size of the list is: 6 | ||
+ | 2300 1 2 3 -3200 4 | ||
+ | Deleting node 2... | ||
+ | Size of the list is: 5 | ||
+ | 2300 1 3 -3200 4 | ||
+ | Size of the list is: 5 | ||
+ | 2300 1 3 -3200 4 | ||
+ | The node location of 3 is 2 | ||
+ | lab46: | ||
+ | </ | ||
+ | \\ | ||
+ | After verifying the linked list library, I then added the linkedListLibrary directory and its files to the Subversion repository.\\ | ||
+ | <cli> | ||
+ | lab46: | ||
+ | svn: warning: ' | ||
+ | svn: warning: ' | ||
+ | A | ||
+ | A | ||
+ | A (bin) linkedListLib1.o | ||
+ | A | ||
+ | A | ||
+ | A (bin) linkedListLib2.o | ||
+ | A | ||
+ | A | ||
+ | A (bin) linkedListLib3.o | ||
+ | A | ||
+ | A | ||
+ | A (bin) linkedListLib4.o | ||
+ | lab46: | ||
+ | A (bin) libjrdll.a | ||
+ | </ | ||
+ | After adding the linked list library files to the Subversion repository, I committed them as well.\\ | ||
+ | <cli> | ||
+ | lab46: | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Adding | ||
+ | Sending | ||
+ | Transmitting file data ............. | ||
+ | Committed revision 12. | ||
+ | lab46: | ||
+ | Adding | ||
+ | Transmitting file data . | ||
+ | Committed revision 13. | ||
+ | lab46: | ||
+ | </ | ||
+ | Cleaning up and committing Linked List Library:\\ | ||
+ | <cli> | ||
+ | lab46: | ||
+ | A | ||
+ | lab46: | ||
+ | A | ||
+ | lab46: | ||
+ | Sending | ||
+ | Sending | ||
+ | Sending | ||
+ | Sending | ||
+ | Sending | ||
+ | Adding | ||
+ | Adding | ||
+ | Transmitting file data ....... | ||
+ | Committed revision 23. | ||
+ | lab46: | ||
+ | </ | ||
+ | =====Reflection===== | ||
+ | Before starting this project, I was very apprehensive about working with linked lists, however, through the examples of code blocks and drawings of nodes with pointers that Matthew showed the class and through conversations I had with Matthew both e-mail and in person, I have becmome comfortable implementing the functions that create and manipulate them. I have learned to work with double indirection of structure pointers, and structure pointer syntax. I have also learned how to create and use a static library. | ||
+ | |||
+ | =====References===== | ||
+ | In performing this project, the following resources were referenced: | ||
+ | |||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * http:// | ||
+ | * http:// |