GithubHelp home page GithubHelp logo

fagan2888 / linkedlistimplementationsproject Goto Github PK

View Code? Open in Web Editor NEW

This project forked from epogash/linkedlistimplementationsproject

0.0 1.0 0.0 1.8 MB

This project was done independently for COP 3530 (Data Structures and Algorithms). Each linked list variation was created to adhere to the assignments specifications, as described in the README. (Created Fall 2014)

C++ 100.00%

linkedlistimplementationsproject's Introduction

Linked List Implementations Project

This project was done independently for COP 3530 (Data Structures and Algorithms). Each linked list variation was created to adhere to the assignments specification. In addition, each linked list implementation was thoroughly tested using Catch - a C++ unit testing framework. I received an A on this project.

"Simple Singly-Linked List (SSLL)

A basic implementation: whenever an item is added to the list, a new node is allocated to hold it; whenever an item is removed, the node that held it is deallocated.

Pool-using Singly-Linked List (PSLL)

Similar to the SSLL, except the node allocation/deallocation strategy is different. The list maintains a pool of unused nodes. Whenever an item is added to the list, use a node in the pool of free nodes; if there are no free nodes, then a new node is allocated. Whenever an item is removed, the node is added to the pool.

Because we don't want the pool to waste too much memory, whenever the list contains ≥ 100 items AND the pool contains more nodes than half the list size, reduce the number of pool nodes to half the list size (by deallocating the excess).

Simple Dynamic Array-based List (SDAL)

A basic implementation: the initial array size is passed as a parameter to the constructor; if no value is passed then default to a backing array with 50 slots. Whenever an item is added and the backing array is full, allocate a new array 150% the size of the original, copy the items over to the new array, and deallocate the original one.

Because we don't want the list to waste too much memory, whenever the array's size is ≥ 100 slots and fewer than half the slots are used, allocate a new array 50% the size of the original, copy the items over to the new array, and deallocate the original one.

Chained Dynamic Array-based List (CDAL)

This is the one described in the discussion session. The idea again is that a linked-list of arrays is used as the backing store. Each array has 50 slots. The chain starts off containing just a single array. When the last array in the chain is filled, and a new item is inserted, a new array is added to the chain.

Because we don't want the list to waste too much memory, whenever the more than half of the arrays are unused (they would all be at the end of the chain), deallocate half the unused arrays."

  • written by Dave Small (Data Structures and Algorithms Teacher)

In addition, the following checklist was used to ensure all methods were implemented:

List variety: Chained Dynamic Array-based List written by Pogash, Eric COP 3530, 2014F <1085> "

Part I:

My LIST implementation uses the data structure described in the part I instructions and conforms to the technique required for this list variety:

My LIST implementation 100% correctly supports the following methods as described in part I:

  • replace:
  • insert:
  • push_back:
  • push_front:
  • remove:
  • pop_back:
  • pop_front:
  • item_at:
  • is_empty:
  • clear:
  • contains:
  • print:

====================================================================== Part II:

My LIST implementation 100% correctly supports the following methods as described in part II:

  • size:
  • begin (returning an iterator):
  • end (returning an iterator):
  • begin (returning a const iterator):
  • end (returning an const iterator):

My LIST implementation 100% correctly supports the following data members as described in part II:

  • size_t
  • value_type
  • iterator
  • const_iterator

My ITERATOR implementation 100% correctly supports the following methods as described in part II:

  • constructor:
  • explicit constructor:
  • operator*:
  • operator->:
  • operator=:
  • operator++ (pre):
  • operator++ (post):
  • operator==:
  • operator!=:

My ITERATOR implementation 100% correctly supports the following data members as described in part II:

  • value_type:
  • difference_type:
  • reference:
  • pointer:
  • iterator_category:
  • self_type:
  • self_reference:

My CONST ITERATOR implementation 100% correctly supports the following methods as described in part II:

  • constructor:
  • explicit constructor:
  • operator*:
  • operator->:
  • operator=:
  • operator++ (pre):
  • operator++ (post):
  • operator==:
  • operator!=:

My CONST ITERATOR implementation 100% correctly supports the following data members as described in part II:

  • value_type:
  • difference_type:
  • reference:
  • pointer:
  • iterator_category:
  • self_type:
  • self_reference:

====================================================================== Part III:

My LIST implementation 100% correctly supports the following methods as described in part III:

  • operator[]:
  • operator[] const:

For my LIST's methods

  • I wrote documentation identifying the complete behavior (both normal and exceptional) of the method, AND

  • when something unexpected occurs, the method throws appropriately typed exceptions, AND

  • my implementation behaves 100% precisely as documented, AND

  • I have proven this by creating a suite of CATCH unit tests for the method to verify that the method behaves as documented, AND

  • the method passes all of those unit tests.

  • replace:
  • insert:
  • push_back:
  • push_front:
  • remove:
  • pop_back:
  • pop_front:
  • item_at:
  • is_empty:
  • clear:
  • contains:
  • print:
  • size:
  • begin (returning an iterator):
  • end (returning an iterator):
  • begin (returning a const iterator):
  • end (returning an const iterator):
  • operator[]:
  • operator[] const:

For my ITERATOR's methods

  • I wrote documentation identifying the complete behavior (both normal and exceptional) of the method, AND

  • when something unexpected occurs, the method throws appropriately typed exceptions, AND

  • my implementation behaves 100% precisely as documented, AND

  • I have proven this by creating a suite of CATCH unit tests for the method to verify that the method behaves as documented, AND

  • the method passes all of those unit tests.

  • constructor:
  • explicit constructor:
  • operator*:
  • operator->:
  • operator=:
  • operator++ (pre):
  • operator++ (post):
  • operator==:
  • operator!=:

For my CONST ITERATOR's methods

  • I wrote documentation identifying the complete behavior (both normal and exceptional) of the method, AND

  • when something unexpected occurs, the method throws appropriately typed exceptions, AND

  • my implementation behaves 100% precisely as documented, AND

  • I have proven this by creating a suite of CATCH unit tests for the method to verify that the method behaves as documented, AND

  • the method passes all of those unit tests.

  • constructor:
  • explicit constructor:
  • operator*:
  • operator->:
  • operator=:
  • operator++ (pre):
  • operator++ (post):
  • operator==:
  • operator!=:

My LIST implementation compiles correctly using g++ v4.8.2 on the OpenBSD VM:

My UNIT TESTS compiles correctly using g++ v4.8.2 on the OpenBSD VM:

My UNIT TESTS run correctly on the OpenBSD VM: "

  • written by Dave Small

linkedlistimplementationsproject's People

Contributors

epogash avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.