I have a homework question that simply shows a linked list of 3 elements (each one with a character in it, 'A', 'B', and 'C' respectively), with the 'head' pointer pointing at the first value of the list, and a 'current' pointer set to null. The question wants me to draw out the list after 3 insert commands are performed

list.insert('M')
list.insert('N')
list.insert'(O')

Where does these elements get put into? The beginning of the list, the end?
Also, if I did:

list.start();
list.getNext(ch);
list.getNext(ch);
list.insert('T');

Where would the T go? Between the first two elements because of the list starting at the beginning?

Member Avatar for danb737

When you insert an element in a linked list, what is the programming actually doing ? What happens to the current pointer ?

when you actually insert an element it depends on how you define the insertion function. You can define insertion function to insert new elements at the beginning of the list as well as you can define the insertion function to insert an element after the last element of insertion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.