0

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?

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by sashankalladi
0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.