inserción listas enlazadas simples

Download Inserción Listas Enlazadas Simples

If you can't read please download the document

Upload: yatarihuana

Post on 16-Apr-2017

4.295 views

Category:

Education


2 download

TRANSCRIPT

Diapositiva 1

a. La lista no existeLista Enlazada Simple - Insercin NodosNode top = null;null

b. El nodo debe insertarse al inicio de la listaLista Enlazada Simple - Insercin Nodos

c. El nodo debe insertarse al final de la listaLista Enlazada Simple - Insercin Nodos1. temp = new Node (); temp.name = "C"; temp.next = null;

2. Node temp2;

3. temp2 = top;

4. while (temp2.next != null) temp2 = temp2.next;

5. temp2.next = temp;

d. El nodo debe insertarse entre dos nodos, ej: entre A y C.Lista Enlazada Simple - Insercin Nodostemp = new Node (); temp.name = "D";

Node temp2;

temp2 = top;

4. while (temp2.name.equals ("A") == false) {temp2 = temp2.next; }temp.next = temp2.next;

temp2.next = temp;