logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Himani KhatterStatistics
(/5)

505 Answers

Hire Me
expert
Pam SalvasLaw
(5/5)

675 Answers

Hire Me
expert
Logan AndressonPsychology
(5/5)

528 Answers

Hire Me
expert
Jayant KumarFinance
(/5)

512 Answers

Hire Me
C++ Programming

Implement a templated library for a doubly-linked list class doubly linked list is made up of Nodes

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Implement a templated library for a doubly-linked list class. A doubly linked list is made up of Nodes. Each node contains a value and a pointer to the next element in the sequence as well as to the previous element. You can think of it like the barrel of monkeys below.

Each monkey is a Node with its body the value and its arms the pointers to the next and previous Node.

The way that the Doubly Linked List keeps track of its nodes is through two pointers: head and tail. Head points to the first element in the list and tail points to the last element in the list so you end up with something that looks like 

Your doubly linked list will be templated over the type of element it stores in the Node.

While doubly-linked lists may appear similar to vectors the way that they are stored in memory causes them to have very different performance characteristics.

  • Insertion and deletion of elements at both the front and end of a doubly-linked list are very quick while only insertions and deletions at the end of vectors are efficient.
  • To access an element in a doubly-linked list you must go through all of the elements that come before it but with a vector the amount of time it takes to access an element is constant

So if you do a lot of removals and insertions a doubly-linked list is probably better but if you do a lot of random element accesses a vector would be superior.

The Classes

Doubly Linked List

  • The doubly linked list class.
  • You will need to add the members mentioned in the problem description
  • Templated over the type of element it stores

Doubly Linked Node

  • A Node in the Doubly Linked List Class
  • I haven't given you anything here so what you do is up to you but make sure it has at least the members discussed in the problem description
  • Templated over the type of value that it stores

Iterators

  • All of the iterators you are creating are bidirectional iterators.
  • Implementing them will be a little different from what we've covered in class because our container is not indexed based and does not possess an at method. Don't worry though, the implementation is not hard.

Foward iterators

  • Doubly Linked List Iterator
  • Const Doubly Linked List Iterator
  • These iterators move from the start of the list to the end of the list

Reverse iterators

  • Reverse Doubly Linked List Iterator
  • Const Reverse Doubly Linked List Iterator
  • These iterators move from the end of the list to the start of the list
  • These iterators behave similarily to std::vector's reverse iterators and I recommend you take a look over the example if you haven't done anything with reverse iterators before.

Exceptions

  • The string returned by the what method can contain anything you want it to but make it relevant to the problem that is happening.

Doubly Linked List Error

  • A generic exception for representing an error that has occurred when working with a Doubly Linked List
  • Inherits from: std::exception
  • Thrown by: None

Doubly Linked List Empty Error

  • An exception representing that the operation could not be done because the list is empty
  • Inherits from: DoublyLinkedLIstError
  • Thrown by: DoublyLinkedList::front and DoublyLinkedList::back

Doubly Linked List Out Of Bounds Error

  • An exception representing that the operation could not be done because the iterator is out of bounds
  • Inherits from: DoublyLinkedLIstError
  • Thrown by: operator* in the iterators

Testing

We will once again be using Google Test to test your program.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme