Updated Linked List to look at head instead of count

This commit is contained in:
Luke Else 2022-11-15 07:42:33 +00:00
parent 23e7860e43
commit 700d6696c8

View File

@ -42,7 +42,7 @@ namespace Datastructures {
template <typename T> template <typename T>
void LinkedList<T>::append(T value) { void LinkedList<T>::append(T value) {
mCount++; mCount++;
if (mCount == 0) { if (mHead == nullptr) {
mHead = std::make_shared<Nodes::LinkedListNode<T>>(value); mHead = std::make_shared<Nodes::LinkedListNode<T>>(value);
mTail = mHead; mTail = mHead;
return; return;