Created
March 12, 2013 13:19
-
-
Save Ratstail91/5142812 to your computer and use it in GitHub Desktop.
Playing with a linked list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef LINKEDLIST_HPP_ | |
#define LINKEDLIST_HPP_ | |
class Node { | |
public: | |
Node() { | |
next = nullptr; | |
} | |
virtual ~Node() {} | |
virtual Node* GetNext() { | |
return next; | |
} | |
virtual Node* SetNext(Node* p) { | |
return next = p; | |
} | |
virtual bool operator<(Node&)=0; | |
virtual bool operator>(Node&)=0; | |
private: | |
node* next; | |
}; | |
class LinkedList { | |
public: | |
LinkedList() { | |
head = nullptr; | |
tail = nullptr; | |
} | |
virtual ~LinkedList() {} | |
void PushFront(Node* p) { | |
// | |
} | |
void PushBack(Node* p) { | |
// | |
} | |
void PushFront(LinkedList* p) { | |
// | |
} | |
void PushBack(LinkedList* p) { | |
// | |
} | |
Node* PopFront(int count = 1) { | |
// | |
} | |
Node* PopBack(int count = 1) { | |
// | |
} | |
Node* Pop(int position, int count = 1) { | |
// | |
} | |
void Sort() { | |
// | |
} | |
void Shuffle() { | |
// | |
} | |
int Size() { | |
// | |
} | |
Node* begin() { | |
return head; | |
} | |
Node* end() { | |
return tail; | |
} | |
private: | |
Node* head; | |
Node* tail; | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment