unhandled exception/linked list
Nov 26, 2013 at 8:30am Nov 26, 2013 at 8:30am UTC
hi guys, i am trying to implement a function insert in a hash table
i have this class and am trying to create a linked list
the code compiles however it doesn't run
can you please find whats wrong with my code?
while debugging i always get an unhandled exception in the while loop. can you tell me what does that mean?
thank you a lot
this is part of the code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
class node {
public :
typedef node <Key, Value> * ptr;
private :
Key KEY;
Value VALUE;
node <Key, Value> * next;
public :
node * NODE;
node * head;
node * tail;
node (){
KEY=0;
VALUE=0;
}
node (Key & k, Value & v){
KEY=k;
VALUE=v;
};
Key & key(){
return KEY;
};
Value & value(){
return VALUE;
};
bool hashNext() const {
return next!=NULL;
}
ptr getNext() const {
return next;
}
ptr insert(Key & k, Value & v){
if (NODE==NULL){
NODE = new node;
NODE->KEY=k;
NODE->VALUE=v;
NODE->next=NULL;
tail=NODE;
head=NODE;
}
else {
NODE = new node;
tail=head;
while (tail->next!=NULL){
tail=tail->next;
}
NODE->KEY=k;
NODE->VALUE=v;
NODE->next=tail;
NODE=NODE->next;
}
return NODE;
};
};
Nov 26, 2013 at 10:00am Nov 26, 2013 at 10:00am UTC
Nov 26, 2013 at 11:15am Nov 26, 2013 at 11:15am UTC
thank you
Topic archived. No new replies allowed.