Mark the following statements as true or false. In a linked list, the order of t
ID: 3572574 • Letter: M
Question
Mark the following statements as true or false. In a linked list, the order of the elements is determined by the order in which the nodes were created to store the elements. In a linked list, memory allocated for the nodes is sequential. A single linked list can be traversed in either direction. In a linked list, the nodes are always inserted either in the beginning or at the end because a linked list is not a random access data structure. Item insertion (and deletion) in a linked list with header and trailer nodes is simpler than in an ordinary linked list because the former list has no special cases. The head pointer of a linked list should not be used to traverse the list. Consider the linked list shown in Figure 5-57. Assume that the nodes are in the usual info-link form. Use this list to answer Exercises 2 through 7. If necessary, declare additional variables. (Assume that list, p, s, A, and B are pointers of the type nodeType.)Explanation / Answer
1. a) ans - True
a linked list is a list of items called nodes, in which the order of the nodes is detemined by the address , called a link, stored in each node.
1.b) ans - true
a linked list is a linear collection of data elements, called nodes, each pointing to the next node by means of a pointer. It is a data structure consisting of a group of nodes which together represent a sequence.
Two most natural ways of storing sequences in computer memory are arrays and linked lists.
We model the memory as a sequence of memory cells, each of which has a unique address (a 32 bit non-negative integer on a 32-bit machine).
An array is simply a contiguous piece of memory, each cell of which stores one object of the sequence stored in the array (or rather a reference to the object). In a singly linked list, we allocate two successive memory cells for each object of the sequence.
These two memory cells form a node of a sequence. The first stores the object and the second stores a reference to the next node of the list (i.e., the address of the first memory cell of the next node).
1.c) ans - false
single linked list can traverse only in one direction
1.d) ans - false
in a singly linked list nodes can be inserted or deleted in the begining , middle and end of the node
node pointer can be used to determine net node of the element in the list.
1.e) ans - true
1.f) ans - true
the first ( or head) pointer of a linked list is always fied, pointing to the first node in the list. to traverse a linked list , the program must use a pointer different than the head pointer of the list, intiaalized to the first node in the list.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.