Work on adding example for basic datastructs
This commit is contained in:
38
plates/cpp-datastruct/include/lib-datastruct.h
Normal file
38
plates/cpp-datastruct/include/lib-datastruct.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef LDS_H
|
||||
#define LDS_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
enum CONST {
|
||||
MAX=10
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class ListNode {
|
||||
public:
|
||||
ListNode() : next(NULL) {};
|
||||
ListNode(T val) : data(val), next(NULL) {};
|
||||
// Sneak more of Push() through node concstr?
|
||||
// ListNode(T val, LinkedList& l) data(val), next(l.Top());
|
||||
private:
|
||||
T data;
|
||||
ListNode* next;
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class LinkedList {
|
||||
|
||||
public:
|
||||
LinkedList() {};
|
||||
void Push(T val) {};
|
||||
T Pop();
|
||||
T Top();
|
||||
void Display() const;
|
||||
|
||||
private:
|
||||
// ListNode data[MAX];
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user