[SOLVED] 02393 C++ Programming Assignment 10

30.00 $

Category:

Description

Rate this product

Doubly-Linked Lists

doubly-linked lists. The specifification of the class is provided in fifile doubly-linked.h,

available in CodeJudge. Such fifile is imported by the test programs. Your goal

is to implement the class in a fifile doubly-linked.cpp.

The class List implements lists using the following structures for list ele

ments:

s t r u c t Node {

i n t v al ;

Node nex t ;

Node prev ;

} ;

Each Node contains a value (an integer) and two pointers: one meant to

point to the next element of the list and one meant to point to the previous

element in the list.

The class provides the following methods that you need to implement:

  • A constructor and a destructor, with no arguments;
  • void insert(int n): insert an integer at the end of the list;
  • void reverse(void): reverse the list;
  • void print(void): print the list to cout in the same format as the input

(i.e. integers separated by spaces);

Challenge

Implement the class ignoring the prev link, i.e. as it would be a

single-linked list.