Give pseudocode for inserting a node in front of the head node in a linked list.

What will be an ideal response?

1) Create a dynamic variable for the node to be inserted, pointed to by temp_ptr:
temp_ptr = new NodeType;
2) Set the data members of the node
3) make the link field of the new node point to the first node (head node) of the list.
4) make the head pointer point to the new node.

Computer Science & Information Technology

You might also like to view...

Verification is the practice of testing software as part of the larger software implementation process.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The worst case in linear search is that every element must be checked to determine whether the search key exists, which occurs if the search key ________.

a. is the last array element b. is not present c. is the last array element or is not present d. None of the above.

Computer Science & Information Technology