Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [code]class List{
- node head; //it does not hold meaningful data
- };
- void List::List(): head(&head) //circular
- {}
- void List::Add(double data){
- node *lower_bound = &head;
- while( lower_bound->next != &head and lower_bound->next->data < data )
- lower_bound = lower_bound->next;
- //here it holds that `lower_bound->next->data > data'
- //or that we are at the end of the list
- lower_bound->next = new node(data, lower_bound->next);
- }[/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement