Data Structures in C++
ProtectedLinkedList.hpp
<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD Go to the documentation of this file.
1 /**
2  * @author Douglas De Rizzo Meneghetti (douglasrizzom@gmail.com)
3  * @date 2017-6-14
4  * @brief Doubly-linked list implementation with dynamic memory allocation.
5  */
6 
7 #ifndef AULA1_PROTECTEDLINKEDLIST_HPP
8 #define AULA1_PROTECTEDLINKEDLIST_HPP
9 
10 #include <string>
11 #include <stdexcept>
12 #include "Node.hpp"
13 #include "DataStructure.hpp"
14 
15 using namespace std;
16 
17 //! Doubly-linked list implementation with dynamic memory allocation.
18 //! Many methods in this class are protected so the class can be used as an
19 // extension for other data structures.
20 //! \tparam T The type of object the data structure will contain
21 template<class T>
23  private:
24 
25  Node<T> *first;
26  Node<T> *last;
27  int size = 0;
28 
29  public:
30 
31  string getName() {
32  return "Protected Linked List";
33  }
34 
36  first = last = NULL;
37  }
38 
40 
41  while (first != NULL) {
42  Node<T> *tmp = first;
43  first = first->getNext();
44  delete tmp;
45  }
46  last = NULL;
47  size = 0;
48  }
49 
50  protected:
51 
52  Node<T> *getNode(int index) {
53  Node<T> *tmp;
54 
55  if (index <= size / 2) {
56  tmp = first;
57 
58  for (int i = 0; i < index; i ++)
59  tmp = tmp->getNext();
60  }
61  else {
62  tmp = last;
63 
64  for (int i = 0; i < size - index; i ++)
65  tmp = tmp->getPrevious();
66  }
67  return tmp;
68  }
69 
70  //! create the structure and populate it with the data from the array
71  //! \param data an array with data with which the structure will be
72  // initialized
73  explicit ProtectedLinkedList(const T data[]) {
74  for (int i = 0; i <= (sizeof(data) / sizeof(data[0])); i ++) {
75  insert(data[i]);
76  }
77  }
78 
79  Node<T> *getFirst() const {
80  return first;
81  }
82 
83  Node<T> *getLast() const {
84  return last;
85  }
86 
87  //! Insert an element at the end of the list
88  //! \param val the value to be inserted
89  virtual void insert(const T val) {
90  ProtectedLinkedList::insert(val, size);
91  }
92 
93  //! Insert an element at the specified position in the list
94  //! \param val the value to be inserted
95  //! \param index position of the list that the element will be inserted on
96  virtual void insert(const T val, const int index) {
97  if (index < 0) throw std::out_of_range("Negative index not allowed.");
98 
99  if (index > size) throw std::out_of_range("Nonexistent index.");
100 
101  // if it's the first element on the list, create the first node
102  if (size == 0) {
103  first = new Node<T>();
104  first->setValue(val);
105 
106  // first and last both point to the same node at the beginning
107  last = first;
108  }
109 
110  // if the insertion is at the beginning,
111  // use the pointer to the first node to
112  // speed things up and replace first too
113  else if (index == 0) {
114  first->setPrevious(new Node<T>());
115  first->getPrevious()->setNext(first);
116  first = first->getPrevious();
117  first->setValue(val);
118  }
119 
120  // the same applies when an insertion is made in the last node
121  // this is useful for the stack and queue implementations
122  else if (index == size) {
123  last->setNext(new Node<T>());
124  last->getNext()->setPrevious(last);
125  last = last->getNext();
126  last->setValue(val);
127  }
128 
129  // if the index is in the middle of the list, it must be traversed
130  else {
131  Node<T> *next = getNode(index);
132  Node<T> *previous = next->getPrevious();
133 
134  // a new node is created and put between
135  // the current node and the next one
136  Node<T> *middle = new Node<T>();
137  middle->setValue(val);
138 
139  middle->setNext(next);
140  next->setPrevious(middle);
141 
142  middle->setPrevious(previous);
143  previous->setNext(middle);
144  }
145  size ++;
146  }
147 
148  //! Remove an element from the list
149  //! \param index position of the element to be removed
150  //! \return the element that is being removed
151  virtual T remove(const int index) {
152  if (index < 0) throw std::out_of_range("Negative index not allowed.");
153 
154  if (index >= size) throw std::out_of_range("Nonexistent index in list.");
155 
156  Node<T> *tmp = getNode(index);
157 
158  T ret = tmp->getValue();
159 
160  if (tmp->getPrevious() != NULL)
161  tmp->getPrevious()->setNext(tmp->getNext());
162  else
163  first = tmp->getNext();
164 
165  if (tmp->getNext() != NULL)
166  tmp->getNext()->setPrevious(tmp->getPrevious());
167  else
168  last = tmp->getPrevious();
169 
170  size --;
171 
172  tmp->setNext(NULL);
173  tmp->setPrevious(NULL);
174  delete tmp;
175 
176  return ret;
177  }
178 
179  //! Get the element at the specified position in the list, without removing
180  // it
181  //! \param index index of the desired element
182  virtual T get(const int index) {
183  if (index < 0) throw std::out_of_range("Negative index not allowed.");
184 
185  if (index > size) throw std::out_of_range("Nonexistent index.");
186 
187  Node<T> *tmp = getNode(index);
188  return tmp->getValue();
189  }
190 
191  //! Creates an Iterator, an object that allows the sequential
192  //! access of values in a Linked List without the search overhead
193  //! \return an Iterator starting from the first node of the list
194  virtual Iterator<T> iterator() {
195  return Iterator<T>(first);
196  }
197 
198  public:
199 
200  int getSize() {
201  return size;
202  }
203 
204  bool isEmpty() {
205  return size == 0;
206  }
207 
208  bool isFull() {
209  return false;
210  }
211 };
212 
213 #endif // ifndef AULA1_PROTECTEDLINKEDLIST_HPP
Node< T > * getLast() const
======= Go to the documentation of this file.
1 /**
2  * @author Douglas De Rizzo Meneghetti (douglasrizzom@gmail.com)
3  * @date 2017-6-14
4  * @brief Doubly-linked list implementation with dynamic memory allocation.
5  */
6 
7 #ifndef AULA1_PROTECTEDLINKEDLIST_HPP
8 #define AULA1_PROTECTEDLINKEDLIST_HPP
9 
10 #include <string>
11 #include <stdexcept>
12 #include "Node.hpp"
13 #include "DataStructure.hpp"
14 #include "Iterator.hpp"
15 
16 using namespace std;
17 
18 //! Doubly-linked list implementation with dynamic memory allocation.
19 //! Many methods in this class are protected so the class can be used as an extension for other data structures.
20 //! \tparam T The type of object the data structure will contain
21 template<class T>
23  private:
24 
25  Node<T> *first;
26  Node<T> *last;
27  int size = 0;
28 
29  public:
30 
31  string getName() {
32  return "Protected Linked List";
33  }
34 
36  first = last = NULL;
37  }
38 
40 
41  while (first != NULL) {
42  Node<T> *tmp = first;
43  first = first->getNext();
44  delete tmp;
45  }
46  last = NULL;
47  size = 0;
48  }
49 
50  protected:
51 
52  Node<T> *getNode(int index) {
53  Node<T> *tmp;
54 
55  if (index <= size / 2) {
56  tmp = first;
57 
58  for (int i = 0; i < index; i ++)
59  tmp = tmp->getNext();
60  }
61  else {
62  tmp = last;
63 
64  for (int i = 0; i < size - index; i ++)
65  tmp = tmp->getPrevious();
66  }
67  return tmp;
68  }
69 
70  //! create the structure and populate it with the data from the array
71  //! \param data an array with data with which the structure will be
72  // initialized
73  explicit ProtectedLinkedList(const T data[]) {
74  for (int i = 0; i <= (sizeof(data) / sizeof(data[0])); i ++) {
75  insert(data[i]);
76  }
77  }
78 
79  Node<T> *getFirst() const {
80  return first;
81  }
82 
83  Node<T> *getLast() const {
84  return last;
85  }
86 
87  //! Insert an element at the end of the list
88  //! \param val the value to be inserted
89  virtual void insert(const T val) {
90  ProtectedLinkedList::insert(val, size);
91  }
92 
93  //! Insert an element at the specified position in the list
94  //! \param val the value to be inserted
95  //! \param index position of the list that the element will be inserted on
96  virtual void insert(const T val, const int index) {
97  if (index < 0) throw out_of_range("Negative index not allowed.");
98 
99  if (index > size) throw out_of_range("Nonexistent index.");
100 
101  // if it's the first element on the list, create the first node
102  if (size == 0) {
103  first = new Node<T>();
104  first->setValue(val);
105 
106  // first and last both point to the same node at the beginning
107  last = first;
108  }
109 
110  // if the insertion is at the beginning,
111  // use the pointer to the first node to
112  // speed things up and replace first too
113  else if (index == 0) {
114  first->setPrevious(new Node<T>());
115  first->getPrevious()->setNext(first);
116  first = first->getPrevious();
117  first->setValue(val);
118  }
119 
120  // the same applies when an insertion is made in the last node
121  // this is useful for the stack and queue implementations
122  else if (index == size) {
123  last->setNext(new Node<T>());
124  last->getNext()->setPrevious(last);
125  last = last->getNext();
126  last->setValue(val);
127  }
128 
129  // if the index is in the middle of the list, it must be traversed
130  else {
131  Node<T> *next = getNode(index);
132  Node<T> *previous = next->getPrevious();
133 
134  // a new node is created and put between
135  // the current node and the next one
136  Node<T> *middle = new Node<T>();
137  middle->setValue(val);
138 
139  middle->setNext(next);
140  next->setPrevious(middle);
141 
142  middle->setPrevious(previous);
143  previous->setNext(middle);
144  }
145  size ++;
146  }
147 
148  //! Remove an element from the list
149  //! \param index position of the element to be removed
150  //! \return the element that is being removed
151  virtual T remove(const int index) {
152  if (index < 0) throw out_of_range("Negative index not allowed.");
153 
154  if (index >= size) throw out_of_range("Nonexistent index in list.");
155 
156  Node<T> *tmp = getNode(index);
157 
158  T ret = tmp->getValue();
159 
160  if (tmp->getPrevious() != NULL)
161  tmp->getPrevious()->setNext(tmp->getNext());
162  else
163  first = tmp->getNext();
164 
165  if (tmp->getNext() != NULL)
166  tmp->getNext()->setPrevious(tmp->getPrevious());
167  else
168  last = tmp->getPrevious();
169 
170  size --;
171 
172  tmp->setNext(NULL);
173  tmp->setPrevious(NULL);
174  delete tmp;
175 
176  return ret;
177  }
178 
179  //! Get the element at the specified position in the list, without removing
180  // it
181  //! \param index index of the desired element
182  virtual T get(const int index) {
183  if (index < 0) throw out_of_range("Negative index not allowed.");
184 
185  if (index > size) throw out_of_range("Nonexistent index.");
186 
187  Node<T> *tmp = getNode(index);
188  return tmp->getValue();
189  }
190 
191  //! Creates an Iterator, an object that allows the sequential
192  //! access of values in a Linked List without the search overhead
193  //! \return an Iterator starting from the first node of the list
194  virtual Iterator <T> iterator() {
195  return Iterator<T>(first);
196  }
197 
198  public:
199 
200  int getSize() {
201  return size;
202  }
203 
204  bool isEmpty() {
205  return size == 0;
206  }
207 
208  bool isFull() {
209  return false;
210  }
211 };
212 
213 #endif // ifndef AULA1_PROTECTEDLINKEDLIST_HPP
Node< T > * getLast() const
>>>>>>> 36f9b37... fixed dependency of ProtectedLinkedList to Iterator ======= Go to the documentation of this file.
1 /**
2  * @author Douglas De Rizzo Meneghetti (douglasrizzom@gmail.com)
3  * @date 2017-6-14
4  * @brief Doubly-linked list implementation with dynamic memory allocation.
5  */
6 
7 #ifndef AULA1_PROTECTEDLINKEDLIST_HPP
8 #define AULA1_PROTECTEDLINKEDLIST_HPP
9 
10 #include <string>
11 #include <stdexcept>
12 #include "Node.hpp"
13 #include "DataStructure.hpp"
14 #include "Iterator.hpp"
15 
16 using namespace std;
17 
18 //! Doubly-linked list implementation with dynamic memory allocation.
19 //! Many methods in this class are protected so the class can be used as an extension for other data structures.
20 //! \tparam T The type of object the data structure will contain
21 template<class T>
23  private:
24 
25  Node<T> *first;
26  Node<T> *last;
27  int size = 0;
28 
29  public:
30 
31  string getName() {
32  return "Protected Linked List";
33  }
34 
36  first = last = NULL;
37  }
38 
40 
41  while (first != NULL) {
42  Node<T> *tmp = first;
43  first = first->getNext();
44  delete tmp;
45  }
46  last = NULL;
47  size = 0;
48  }
49 
50  protected:
51 
52  Node<T> *getNode(int index) {
53  Node<T> *tmp;
54 
55  if (index <= size / 2) {
56  tmp = first;
57 
58  for (int i = 0; i < index; i ++)
59  tmp = tmp->getNext();
60  }
61  else {
62  tmp = last;
63 
64  for (int i = 0; i < size - index; i ++)
65  tmp = tmp->getPrevious();
66  }
67  return tmp;
68  }
69 
70  //! create the structure and populate it with the data from the array
71  //! \param data an array with data with which the structure will be
72  // initialized
73  explicit ProtectedLinkedList(const T data[]) {
74  for (int i = 0; i <= (sizeof(data) / sizeof(data[0])); i ++) {
75  insert(data[i]);
76  }
77  }
78 
79  Node<T> *getFirst() const {
80  return first;
81  }
82 
83  Node<T> *getLast() const {
84  return last;
85  }
86 
87  //! Insert an element at the end of the list
88  //! \param val the value to be inserted
89  virtual void insert(const T val) {
90  ProtectedLinkedList::insert(val, size);
91  }
92 
93  //! Insert an element at the specified position in the list
94  //! \param val the value to be inserted
95  //! \param index position of the list that the element will be inserted on
96  virtual void insert(const T val, const int index) {
97  if (index < 0) throw out_of_range("Negative index not allowed.");
98 
99  if (index > size) throw out_of_range("Nonexistent index.");
100 
101  // if it's the first element on the list, create the first node
102  if (size == 0) {
103  first = new Node<T>();
104  first->setValue(val);
105 
106  // first and last both point to the same node at the beginning
107  last = first;
108  }
109 
110  // if the insertion is at the beginning,
111  // use the pointer to the first node to
112  // speed things up and replace first too
113  else if (index == 0) {
114  first->setPrevious(new Node<T>());
115  first->getPrevious()->setNext(first);
116  first = first->getPrevious();
117  first->setValue(val);
118  }
119 
120  // the same applies when an insertion is made in the last node
121  // this is useful for the stack and queue implementations
122  else if (index == size) {
123  last->setNext(new Node<T>());
124  last->getNext()->setPrevious(last);
125  last = last->getNext();
126  last->setValue(val);
127  }
128 
129  // if the index is in the middle of the list, it must be traversed
130  else {
131  Node<T> *next = getNode(index);
132  Node<T> *previous = next->getPrevious();
133 
134  // a new node is created and put between
135  // the current node and the next one
136  Node<T> *middle = new Node<T>();
137  middle->setValue(val);
138 
139  middle->setNext(next);
140  next->setPrevious(middle);
141 
142  middle->setPrevious(previous);
143  previous->setNext(middle);
144  }
145  size ++;
146  }
147 
148  //! Remove an element from the list
149  //! \param index position of the element to be removed
150  //! \return the element that is being removed
151  virtual T remove(const int index) {
152  if (index < 0) throw out_of_range("Negative index not allowed.");
153 
154  if (index >= size) throw out_of_range("Nonexistent index in list.");
155 
156  Node<T> *tmp = getNode(index);
157 
158  T ret = tmp->getValue();
159 
160  if (tmp->getPrevious() != NULL)
161  tmp->getPrevious()->setNext(tmp->getNext());
162  else
163  first = tmp->getNext();
164 
165  if (tmp->getNext() != NULL)
166  tmp->getNext()->setPrevious(tmp->getPrevious());
167  else
168  last = tmp->getPrevious();
169 
170  size --;
171 
172  tmp->setNext(NULL);
173  tmp->setPrevious(NULL);
174  delete tmp;
175 
176  return ret;
177  }
178 
179  //! Get the element at the specified position in the list, without removing
180  // it
181  //! \param index index of the desired element
182  virtual T get(const int index) {
183  if (index < 0) throw out_of_range("Negative index not allowed.");
184 
185  if (index > size) throw out_of_range("Nonexistent index.");
186 
187  Node<T> *tmp = getNode(index);
188  return tmp->getValue();
189  }
190 
191  //! Creates an Iterator, an object that allows the sequential
192  //! access of values in a Linked List without the search overhead
193  //! \return an Iterator starting from the first node of the list
194  virtual Iterator <T> iterator() {
195  return Iterator<T>(first);
196  }
197 
198  public:
199 
200  int getSize() {
201  return size;
202  }
203 
204  bool isEmpty() {
205  return size == 0;
206  }
207 
208  bool isFull() {
209  return false;
210  }
211 };
212 
213 #endif // ifndef AULA1_PROTECTEDLINKEDLIST_HPP
Node< T > * getLast() const
>>>>>>> bded2143692dca559ffcc9e7202d9eb5fbfc45bf ======= Go to the documentation of this file.
1 /**
2  * @author Douglas De Rizzo Meneghetti (douglasrizzom@gmail.com)
3  * @date 2017-6-14
4  * @brief Doubly-linked list implementation with dynamic memory allocation.
5  */
6 
7 #ifndef AULA1_PROTECTEDLINKEDLIST_HPP
8 #define AULA1_PROTECTEDLINKEDLIST_HPP
9 
10 #include <string>
11 #include <stdexcept>
12 #include "Node.hpp"
13 #include "DataStructure.hpp"
14 #include "Iterator.hpp"
15 
16 using namespace std;
17 
18 //! Doubly-linked list implementation with dynamic memory allocation.
19 //! Many methods in this class are protected so the class can be used as an extension for other data structures.
20 //! \tparam T The type of object the data structure will contain
21 template<class T>
23  private:
24 
25  Node<T> *first;
26  Node<T> *last;
27  int size = 0;
28 
29  public:
30 
31  string getName() {
32  return "Protected Linked List";
33  }
34 
36  first = last = NULL;
37  }
38 
40 
41  while (first != NULL) {
42  Node<T> *tmp = first;
43  first = first->getNext();
44  delete tmp;
45  }
46  last = NULL;
47  size = 0;
48  }
49 
50  protected:
51 
52  Node<T> *getNode(int index) {
53  Node<T> *tmp;
54 
55  if (index <= size / 2) {
56  tmp = first;
57 
58  for (int i = 0; i < index; i ++)
59  tmp = tmp->getNext();
60  }
61  else {
62  tmp = last;
63 
64  for (int i = 0; i < size - index; i ++)
65  tmp = tmp->getPrevious();
66  }
67  return tmp;
68  }
69 
70  //! create the structure and populate it with the data from the array
71  //! \param data an array with data with which the structure will be
72  // initialized
73  explicit ProtectedLinkedList(const T data[]) {
74  for (int i = 0; i <= (sizeof(data) / sizeof(data[0])); i ++) {
75  insert(data[i]);
76  }
77  }
78 
79  Node<T> *getFirst() const {
80  return first;
81  }
82 
83  Node<T> *getLast() const {
84  return last;
85  }
86 
87  //! Insert an element at the end of the list
88  //! \param val the value to be inserted
89  virtual void insert(const T val) {
90  ProtectedLinkedList::insert(val, size);
91  }
92 
93  //! Insert an element at the specified position in the list
94  //! \param val the value to be inserted
95  //! \param index position of the list that the element will be inserted on
96  virtual void insert(const T val, const int index) {
97  if (index < 0) throw out_of_range("Negative index not allowed.");
98 
99  if (index > size) throw out_of_range("Nonexistent index.");
100 
101  // if it's the first element on the list, create the first node
102  if (size == 0) {
103  first = new Node<T>();
104  first->setValue(val);
105 
106  // first and last both point to the same node at the beginning
107  last = first;
108  }
109 
110  // if the insertion is at the beginning,
111  // use the pointer to the first node to
112  // speed things up and replace first too
113  else if (index == 0) {
114  first->setPrevious(new Node<T>());
115  first->getPrevious()->setNext(first);
116  first = first->getPrevious();
117  first->setValue(val);
118  }
119 
120  // the same applies when an insertion is made in the last node
121  // this is useful for the stack and queue implementations
122  else if (index == size) {
123  last->setNext(new Node<T>());
124  last->getNext()->setPrevious(last);
125  last = last->getNext();
126  last->setValue(val);
127  }
128 
129  // if the index is in the middle of the list, it must be traversed
130  else {
131  Node<T> *next = getNode(index);
132  Node<T> *previous = next->getPrevious();
133 
134  // a new node is created and put between
135  // the current node and the next one
136  Node<T> *middle = new Node<T>();
137  middle->setValue(val);
138 
139  middle->setNext(next);
140  next->setPrevious(middle);
141 
142  middle->setPrevious(previous);
143  previous->setNext(middle);
144  }
145  size ++;
146  }
147 
148  //! Remove an element from the list
149  //! \param index position of the element to be removed
150  //! \return the element that is being removed
151  virtual T remove(const int index) {
152  if (index < 0) throw out_of_range("Negative index not allowed.");
153 
154  if (index >= size) throw out_of_range("Nonexistent index in list.");
155 
156  Node<T> *tmp = getNode(index);
157 
158  T ret = tmp->getValue();
159 
160  if (tmp->getPrevious() != NULL)
161  tmp->getPrevious()->setNext(tmp->getNext());
162  else
163  first = tmp->getNext();
164 
165  if (tmp->getNext() != NULL)
166  tmp->getNext()->setPrevious(tmp->getPrevious());
167  else
168  last = tmp->getPrevious();
169 
170  size --;
171 
172  tmp->setNext(NULL);
173  tmp->setPrevious(NULL);
174  delete tmp;
175 
176  return ret;
177  }
178 
179  //! Get the element at the specified position in the list, without removing
180  // it
181  //! \param index index of the desired element
182  virtual T get(const int index) {
183  if (index < 0) throw out_of_range("Negative index not allowed.");
184 
185  if (index > size) throw out_of_range("Nonexistent index.");
186 
187  Node<T> *tmp = getNode(index);
188  return tmp->getValue();
189  }
190 
191  //! Creates an Iterator, an object that allows the sequential
192  //! access of values in a Linked List without the search overhead
193  //! \return an Iterator starting from the first node of the list
194  virtual Iterator <T> iterator() {
195  return Iterator<T>(first);
196  }
197 
198  public:
199 
200  int getSize() {
201  return size;
202  }
203 
204  bool isEmpty() {
205  return size == 0;
206  }
207 
208  bool isFull() {
209  return false;
210  }
211 };
212 
213 #endif // ifndef AULA1_PROTECTEDLINKEDLIST_HPP
Node< T > * getLast() const
>>>>>>> master
Base class for all data structures.
bool isEmpty()
Check whether the structure is empty.
Node used inside other data structures.
Definition: Node.hpp:15
bool isFull()
Check whether the structure is full.
virtual void insert(const T val, const int index)
Insert an element at the specified position in the list.
<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD =======
virtual Iterator< T > iterator()
Creates an Iterator, an object that allows the sequential access of values in a Linked List without t...
>>>>>>> bded2143692dca559ffcc9e7202d9eb5fbfc45bf =======
virtual Iterator< T > iterator()
Creates an Iterator, an object that allows the sequential access of values in a Linked List without t...
>>>>>>> master
Node< T > * getFirst() const
Node< T > * getNode(int index)
Doubly-linked list implementation with dynamic memory allocation.
virtual T get(const int index)
Get the element at the specified position in the list, without removing.
string getName()
Provides the name of the data structure as a string representation.
virtual T remove(const int index)
Remove an element from the list.
Object that provides iterative powers to classes composed of Node.
Definition: Iterator.hpp:13
ProtectedLinkedList(const T data[])
create the structure and populate it with the data from the array
virtual void insert(const T val)
Insert an element at the end of the list.
<<<<<<< HEAD <<<<<<< HEAD =======
virtual Iterator< T > iterator()
Creates an Iterator, an object that allows the sequential access of values in a Linked List without t...
Node< T > * getFirst() const
Node< T > * getNode(int index)
Doubly-linked list implementation with dynamic memory allocation.
virtual T get(const int index)
Get the element at the specified position in the list, without removing.
string getName()
Provides the name of the data structure as a string representation.
virtual T remove(const int index)
Remove an element from the list.
Object that provides iterative powers to classes composed of Node.
Definition: Iterator.hpp:13
ProtectedLinkedList(const T data[])
create the structure and populate it with the data from the array
virtual void insert(const T val)
Insert an element at the end of the list.
int getSize()
Outputs the number of elements stored in the structure.
>>>>>>> 36f9b37... fixed dependency of ProtectedLinkedList to Iterator =======
int getSize()
Outputs the number of elements stored in the structure.
>>>>>>> bded2143692dca559ffcc9e7202d9eb5fbfc45bf =======
int getSize()
Outputs the number of elements stored in the structure.
>>>>>>> master