You are on page 1of 1

1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:

25: 26: 27: 28: 29: 30: 31: 32: 33: 34:

#include <string> using namespace std; // Lop StringNode // bieu dien mot phan tu trong danh sach lien ket StringLinkedList class StringNode{ private: string data; StringNode * next; friend class StringLinkedList; }; // Lop StringLinkedList // bieu dien mot danh sach lien ket don cac string class StringLinkedList{ public: StringLinkedList(); // kien tao DS rong StringLinkedList(char * filename); // kien tao DS chua // cac xau ghi trong tep filename // moi xau tren 1 dong ~StringLinkedList(); // huy DS bool empty() const; // DS co rong khong? const string& first() const; // lay xau luu trong phan tu dau tien void addFirst(const string & e); // them vao dau DS void removeFirst(); // xoa phan tu dau DS const string& last() const; // lay xau luu trong phan tu cuoi cung void addLast(const string & e); // them vao cuoi DS void print() const; // in toan bo DS private: StringNode * head; // con tro toi phan tu dau DS StringNode * tail; // con tro toi phan tu cuoi DS };

You might also like