Skip to content

Instantly share code, notes, and snippets.

@mirsahib
Last active September 6, 2017 10:19
Show Gist options
  • Save mirsahib/f52a1cdd6859103dcca832f2f1d03471 to your computer and use it in GitHub Desktop.
Save mirsahib/f52a1cdd6859103dcca832f2f1d03471 to your computer and use it in GitHub Desktop.
/*
*
*List.h
*
*Created on: Aug 19, 2017
* Author: Mir Sahib
*
*/
#ifndef LIST_H_
#define LIST_H_
class List{
private:
typedef struct node{
int data;
node* next;
}* nodePtr;
nodePtr head;
nodePtr curr;
nodePtr temp;
nodePtr prev;
public:
List();
nodePtr getHead();// return head memory location
nodePtr getPrev();
void setPrev(nodePtr newPrev);
void setHead(nodePtr newHead);
void addNode(int addData);
void deleteNthPosition(int pos);
void insertNodeToHead(int newData);
void insertToNthPosition(int pos,int newData);
void reverseList();
int lengthOfTheList();
//recursive function
void printRecurs(nodePtr temp);
void reverseRecurs(nodePtr temp);
void printNode();
};
#endif /* LIST_H_ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment