Last active
September 9, 2017 08:35
-
-
Save mirsahib/6c3f22360c3cc106b702ce245bbb0b05 to your computer and use it in GitHub Desktop.
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
/* | |
* | |
*List.h | |
* | |
*Created on: Sep 8, 2017 | |
* Author: Mir Sahib | |
* | |
*/ | |
#ifndef LIST_H_ | |
#define LIST_H_ | |
typedef struct node{ | |
int data; | |
node *next; | |
node *prev; | |
}* nodePtr; | |
class List{ | |
private: | |
nodePtr head; | |
nodePtr temp; | |
nodePtr curr; | |
public: | |
List(); | |
nodePtr get(int index); | |
nodePtr getFirst(); | |
nodePtr getLast(); | |
//insert function | |
void addFirst(int newData); | |
void addLast(int newData); | |
void add(int index,int newData);//nth position | |
//delete function | |
void removeFirst(); | |
void removeLast(); | |
void remove(int index);//nth position | |
//print function | |
void print(); | |
//miscellaneous function | |
int size(); | |
bool isEmpty(); | |
}; | |
#endif /* LIST_H_ */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment