In: Computer Science
In Java
a.ArrayLists are constructed of nodes
that include elements and references to other elements
b.LinkedLists are constructed of nodes that include elements and
references to other elements
c.ArrayLists are, by definition, lists of arrays
d.LinkedLists are, be definition, lists of links
a.Accessing an element in an array by
index is less expensive than accessing an element by index in a
LinkedList
b.Accessing an element in an array by index is less expensive than
accessing an element by index in an ArrayList
c.Accessing an element in an array by index is more expensive than
accessing an element by index in a LinkedList
d.Accessing an element in an array by index is more expensive than
accessing an element by index in an ArrayList
a.Adding an element to the beginning
of an ArrayList is less expensive than adding an element to the
beginning of an array
b.Adding an element to the beginning of an ArrayList is less
expensive than adding an element to the end of an ArrayList
c.Adding a node to the beginning of a LinkedList is less expensive
than adding an element to the beginning of an ArrayList
d.Adding an element to the beginning of an ArrayList is less
expensive than adding a node to the beginning of a LinkedList
a.Linear search of a LinkedList is
less expensive than linear search of an ArrayList
b.Linear search of an ArrayList is less expensive than linear
search of a LinkedList
c.Linear search of a LinkedList is less expensive than linear
search of an array
d.Linear search of an ArrayList is less expensive than linear
search of an array
Which of the following is true?
b.LinkedLists are
constructed of nodes that include elements and references to other
elements
Linked List is defined as a collection of nodes connected together by their references.
Which of the following statements is correct in most cases?
Accessing an element in an array by index is less expensive than accessing an element by index in a LinkedList
Since arrayList uses array internally, so accessing element by index is easier.
Which of the following statements is correct in most cases?
c.Adding a node to the beginning of a LinkedList is less expensive than adding an element to the beginning of an ArrayList
Adding a node at the beginning of the linked list takes O(1) time while adding at the begining of the arrayList takes O(n) time, as all elements have to be shifted to make space for the element to be entered.
Which of the following statements is correct in most
cases?
b.Linear
search of an ArrayList is less expensive than linear search of a
LinkedList
Linear seacth is all about accessing elements by theoir index and since accessing index in arrayList is easier.