What is the functionality of the following code? [code]public void function(Node node) { if(size == 0) head = node; else { Node

Ngô Thị Vân

New member
What is the functionality of the following code?
Code:
public void function(Node node)
{
	if(size == 0)
		head = node;
	else
	{
		Node temp,cur;
		for(cur = head; (temp = cur.getNext())!=null; cur = temp);
		cur.setNext(node);
	}
	size++;
}
A. Inserting a node at the beginning of the list
B. Deleting a node at the beginning of the list
C. Inserting a node at the end of the list
D. Deleting a node at the end of the list
 

Tìm kiếm

Back
Top