please help really urgent..the red colour is the correct output whereas the blue display is my display which has a simple error. please give me advice or help me ....
IP address Count
a 3
b 2
c 2
d 1
found d
** your output **
IP address Count
a 3
b 2
c 2
d 1
//extra space
found d
the blue colour has extra space... wat problem cause tat please.... i think is my insertinorder problem....correct me if i am wrongCode:void IPlist::insertInOrder(string address) // precondition : list is ordered and address is not in list // postcondition : list is ordered and contains address { node *tmp = new node; tmp->IPaddress = address; tmp->count = 1; tmp->link = NULL; if(list == NULL || list->IPaddress > address) // if list is null or ipaddress in list is larger than address { tmp->link = list; // Insertion at list = tmp; // the beginning } else { node *cur = list; node *prev = NULL; while(cur != NULL && cur->IPaddress < address) { prev = cur; // else insertion cur = cur->link; // in the middle } prev->link = tmp; // otherwise insertion tmp->link = cur; // at the end } }



LinkBack URL
About LinkBacks


