Quiz Intro to Linked List
Assume you have a list with 4 elements: A, B, C, and E [ A | 1322 ] ---> [ B | 6543 ] ---> [ C | 2345 ] ----> [ E | 4321 ] Now you want to insert D, which is stored on address 9876 D should be inserted between C and E. Assume you have one variable (pointer) p that has a reference to [ C | 2345 ] and you have a reference to the new node ( D ) that needs to be inserted into the list Which steps should you take in what order? I, II, III, or IV ( I ) 1.set the next pointer of C to 9876(D) 2.set the next pointer of D to 4321(E) ( II ) 1. set the next pointer of D to 4321(E) 2. set the next pointer of C to 9876(D) ( III ) 1.set the next pointer of D to 2345(C) 2.set the next pointer of E to 9876(D) ( IV ) 1. set the next pointer of E to 9876(D) 2. set the next pointer of D to 2345(C)
( II )
Complete the sentence below: Each element in a Linked-List is called a ________________ .
Node
Linked Lists CANNOT be re-sized once they have been created.
False
Which combination of properties best describes a list? -ordered collection, can have duplicates -unordered collection, can have duplicates -ordered collection, no duplicates -unordered collection, no duplicates
ordered collection, can have duplicates
Inserting an element at a specific location of an array is a fairly expensive operation.
True
In order to determine where a linked list starts we use a reference to the beginning of the list. This reference is usually called ___________________ .
head