Computing.Net > Forums > Programming > c++ doubly linked list help!!!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

c++ doubly linked list help!!!

Reply to Message Icon

Name: needhelp21
Date: November 26, 2002 at 09:04:49 Pacific
OS: ME
CPU/Ram: 1.2 duron /512 ddr
Comment:

i been given this task too do but have no idea where to start or how to do it...any one offer any hints? Thanks :)

The first prototype implementation you need to create is based on a doubly linked list storing
single integer values in each cell.
Your Doubly Linked List class must include the following methods:
List(); Default constructor creating an empty list.
List(n, e); Constructor creating a list of n copies of element e.
~List(); Destructor destroying all elements and freeing
memory.
size(); Returns the number of elements in the list.
empty(); Returns True if empty, False otherwise.
clear(); Removes all elements from the list.
assign(n, e); Replaces existing elements with n copies of element e.
operator=() Overloading of the assignment operator
(e.g. CList1 = Clist2)
front(); Returns reference to the first element.
back(); Returns reference to the last element.
push_front(e); Adds element e to the front of the list.
pop_front(); Removes the first element of the list.
push_back(e); Adds element e to the end of the list.
pop_back(); Removes the last element of the list.
insert(iter, e); Inserts a copy of element e at iter position in the
list, and returns a reference to its position.
erase(iter); Removes element at iter, and returns a reference
to the next position in the list.
remove(e); Removes all the elements from the list with value e.



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: November 26, 2002 at 09:17:27 Pacific
Reply:

If you have no idea where to start or how to do it, I would guess that you haven't been paying attention in class and/or have been posting on forums like this to have others do your homework. So my suggestion is that you start paying attention in class, tho if you are on double linked lists, you probably have missed enough that you'll need to start over.

If you are content to go thru life letting others do you work for you, there are plenty of sites that provide C/C++ code.


0

Response Number 2
Name: kev
Date: November 26, 2002 at 13:51:29 Pacific
Reply:

Just thought I'd add that linked lists are terrible...

and complicated.

Thank you.

Kevin :P


0

Response Number 3
Name: Guy
Date: November 26, 2002 at 15:11:21 Pacific
Reply:

I agree with Don and Kev, you sound like you are too far behind.

I'll point out that in C++ any linked list implementation S/B templatized so objects of any type can be handled.

I'd suggest you do some searching on google, there is linked list sample code available (some of it not very good).

G.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


pascal string formatting Package and Deployme



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: c++ doubly linked list help!!!

c++ linked list help www.computing.net/answers/programming/c-linked-list-help/6160.html

Linked List Help!!! www.computing.net/answers/programming/linked-list-help/6453.html

c++ linked list help www.computing.net/answers/programming/c-linked-list-help/6383.html