Search Results

Search found 2 results on 1 pages for 'user258367'.

Page 1/1 | 1 

  • What is the problem with my LinkedList class?

    - by user258367
    class LinkedList { private: int data; LinkedList *ptr; public: LinkedList(int i_data) { data = i_data; ptr = 0; { ~LinkedList() { delete ptr ; } void insert(LinkedList *node) { while(this->next != 0) this = this->next; this->next = node; } } I will be creating a head node like head = new LinkedList(4) and then will be calling like head->insert(new LinkedList(5)) and subsequently . Can you please tell me does above class represent a linkedlist . i think yes it has node which contain address of next node . Please correct me if i am wrong

    Read the article

  • What is problem with below class

    - by user258367
    class LinkedList { private: int data; LinkedList *ptr; public: LinkedList(int i_data) { data = i_data; ptr = 0; { ~LinkedList() { delete ptr ; } void insert(LinkedList *node) { while(this->next != 0) this = this->next; this->next = node; } I will be creating a head node like head = new LinkedList(4) and then will be calling like head->insert(new LinkedList(5)) and subsequently . Can you please tell me does above class represent a linkedlist . i think yes it has node which contain address of next node . Please correct me if i am wrong

    Read the article

1