Three examples of ADTs Answer: Arrays, Array lists, Strings
Nodes consist of two items, what are they? Answer: data, next
In order to delete a node you must have what? Answer: current position and previous position
What is included in a linked list node?
I) a ref...
Three examples of ADTs Answer: Arrays, Array lists, Strings
Nodes consist of two items, what are they? Answer: data, next
In order to delete a node you must have what? Answer: current position and previous position
What is included in a linked list node?
I) a reference to the next node
II) an array reference
III) a data element Answer: I and III
insert the missing code in the following code fragment. The fragment is intended to add a new node to
the head of a linked list:
public class LinkedList
{
....
public void addFirst(Object element)
{
Node newNode = new Node();
newNode.data = element;
,---------
---------
}
....
}
A. first = newNode;
newNode.next = first;
B. newNode.next = first;
first = newNode;
C. first = newNode.next;
newNode.next = first;
D. first = newNode.next;
newNode = first; Answer: B. newNode.next = first;
first = newNode;
Insert the missing code in the following code fragment. This fragment is intended to
remove a node from the head of a linked list:
public class LinkedList
{
...
public Object removeFirst()
, {
if (first == null)
{
throw new
NoSuchElementException();
}
Object element = first.data;
________________
________________
}
...
}
A. first = first.next;
return element;
B. first.next = first;
return element;
C. first = element.next;
return element;
D. first = element.next;
return null; Answer: A. first = first.next;
return element;
Los beneficios de comprar resúmenes en Stuvia estan en línea:
Garantiza la calidad de los comentarios
Compradores de Stuvia evaluaron más de 700.000 resúmenes. Así estas seguro que compras los mejores documentos!
Compra fácil y rápido
Puedes pagar rápidamente y en una vez con iDeal, tarjeta de crédito o con tu crédito de Stuvia. Sin tener que hacerte miembro.
Enfócate en lo más importante
Tus compañeros escriben los resúmenes. Por eso tienes la seguridad que tienes un resumen actual y confiable.
Así llegas a la conclusión rapidamente!
Preguntas frecuentes
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
100% de satisfacción garantizada: ¿Cómo funciona?
Nuestra garantía de satisfacción le asegura que siempre encontrará un documento de estudio a tu medida. Tu rellenas un formulario y nuestro equipo de atención al cliente se encarga del resto.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Schoolflix. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for 13,76 €. You're not tied to anything after your purchase.