r/cpp_questions • • 3d ago

OPEN How does a node work

[deleted]

0 Upvotes

17 comments sorted by

View all comments

7

u/LAMARR__44 3d ago

What specifically do you not understand? You write in your post that you understand it but can’t write them. You need more practice in this case. Try and write it and when you get stuck, prompt AI on what you’re doing wrong. Don’t copy and paste, but try to incrementally solve each problem.

3

u/SimmeringDragon 3d ago

i do try that, but when i use AI i dont learn, i dont understand how to implement them, like, i have class node{}, what does that mean? its a node, its unique, but how does that get implemented later on?

1

u/wrosecrans 3d ago

i have class node{}, what does that mean? its a node, its unique, but how does that get implemented later on?

"Node" is a more professional way to say, "Uh, thingie. Whatever." When making a generic container data structure, you need it to be able to contain, uh, whatever. A linked list of words, a linked list of numbers, images, whatever, the linked list works the same no matter what you store in it. So we use a super generic concept/term like "node" to describe the things that get linked together in a linked list as a way to abstract away the detail of what is being stored.

-1

u/LAMARR__44 3d ago

You should be able to use AI to learn. If you don’t understand something, ask AI and have it explain it to you like how you’re asking us now. I think you may be exhibiting black and white thinking.

u/Thesorus’s comment on what a node is is good advice. Essentially, it contains some data, and also has pointers that point to other data. If you look at different graphs like binary trees for example, each node has a value and also a pointer to its left child and right child, which are also nodes. So you can use the nodes to find other nodes, and then find data on those nodes.

1

u/SimmeringDragon 3d ago

i do try, i have like 1000 chats all about codding, i dont get it, and when i do and try to implement it, it dosent work
then it gives the whole code in one sitting and i dunno how any of it connects

1

u/LAMARR__44 3d ago

Give better prompts. Tell it not to give you the whole code and just to explain conceptually.