Skip to content

Instantly share code, notes, and snippets.

@mirsahib
Last active September 9, 2017 08:35
Show Gist options
  • Save mirsahib/6c3f22360c3cc106b702ce245bbb0b05 to your computer and use it in GitHub Desktop.
Save mirsahib/6c3f22360c3cc106b702ce245bbb0b05 to your computer and use it in GitHub Desktop.
/*
*
*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