473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Nodes and Linked List

KL
I am so confused. I am working on a project for my class, and I can't
remember how to do Nodes and linked lists.

I have the following bit of code but don't know how to proceed from
here. If someone could help direct me to the right answer, not just
give me the code, I would appreciate it:

class Node {
public:
Node( );
Node( int t );
Node( int t, Node *n );
friend class List;
friend ostream& operator<<(ostream&, const Node&);
friend ostream& operator<<(ostream&, const List&);
private:
int time;
int count;
Node *next;
};
/*
class List {
public:
List( );
bool insert(int);
friend ostream& operator<<(ostream& os, const List&);
private:
Node *head;
};
Jan 24 '07 #1
3 1670
On 2007-01-24 17:33, KL wrote:
I am so confused. I am working on a project for my class, and I can't
remember how to do Nodes and linked lists.

I have the following bit of code but don't know how to proceed from
here. If someone could help direct me to the right answer, not just
give me the code, I would appreciate it:
There's a topic called 'Inserting a number into a linked list in
ascending order' which can give you some hints. A quick google should
give you lots of examples, and Wikipedia will probably contain some
sample code too.

--
Erik Wikström
Jan 24 '07 #2
On Jan 24, 8:33 am, KL <klbjor...@aohell.comwrote:
I am so confused. I am working on a project for my class, and I can't
remember how to do Nodes and linked lists.
Walk away from your computer. Far away. Draw on a piece of paper what
you want to do. Not in code, but in picture format, where nodes are
rectangles, and pointers are arrows from one rectangle to another.
Work out the logic first that way. Maybe write some pseudo-code on
your piece of paper. (In other words, take notes about how you solve
the problem.)

Once you're clear on the logic (which is the hard part), then go back
to your computer and translate that logic into code (which is the other
hard part, since C++ is still new to you). At that point, if you run
into syntax problems or whatever, post a question. Something along the
lines of "here's the logic I'm trying to implement. Here's the code I
have so far. What's wrong?"

Michael

Jan 24 '07 #3
KL <kl*******@aohell.comwrites:
I am so confused. I am working on a project for my class, and I can't
remember how to do Nodes and linked lists.
Linked lists are described nicely on Wikipedia
<URL:http://en.wikipedia.org/>.

Next time try searching for your answer in Google or Wikipedia before
posting it - you'll get your answer faster that way.

--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>---<jid:mina86*chrome.pl>--ooO--(_)--Ooo--
Jan 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: alanrn | last post by:
I am using a TreeView to display the hierarchy of a strongly-typed collection (inherited from CollectionBase). The order of the nodes in the TreeView is strictly tied to the order in which they...
47
by: Jeff Relf | last post by:
Hi All, I plan on using the following C++ code to create nodes with unlimited children: // I would like to declare NodeT like this, // but it won't compile because Lnk_T is not defined yet....
5
by: CR | last post by:
I've been to figure out how to get AddSortLast function to add nodes in acsending order (a b c d) I figured it out how to get it to sort in decending order but I can't get it to sort in acsending...
0
by: aredo3604gif | last post by:
I have coded a serie of singly linked lists in ANSI C which I have to use. The lists are then stored in a serie of buckets with chained hash table technique. In the various lists there are nodes...
6
by: jw | last post by:
hi all,i have such 2 classes for a linked list, class Node{ private: int value; Node *next; public: Node() { next=NULL; }
11
by: JoeC | last post by:
I have been using C++ for several years now and I have been reading about nodes. I am a little confused. I understand many of the concepts behind this such as pointers and dynamic binding. My...
5
twillie
by: twillie | last post by:
Hello, I have a linked list in C++ and I am trying to remove all duplicate nodes from the list. The code below is what our prof. wrote on the board in pusdo code in class, yet it doesn't seem to...
4
by: hari60133 | last post by:
In single/double linked list having 10 nodes due to some memory problems the 4th next node is pointing to 3rd node not to a 5 th node, how to findout the 5th node? please explain concept and send...
20
by: sirsnorklingtayo | last post by:
hi guys please help about Linked List, I'm having trouble freeing the allocated memory of a single linked list node with a dynamic char* fields, it doesn't freed up if I use the FREE()...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.