Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×

Explain the function of the following methods in LinkedList 1- addFirs.docx

Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio

Eche un vistazo a continuación

1 de 2 Anuncio

Explain the function of the following methods in LinkedList 1- addFirs.docx

Descargar para leer sin conexión

Explain the function of the following methods in LinkedList 1.
addFirst(E e) 2.
contains(E e) 3.
get(int index) 4. i
ndexOf(E e) 5.
remove() 6.
remove(int index) 7.
set(int index, E e)
Solution
1. addFirst(E e):
It adds an element e at head of linked list

2. contains(E e):
It searches element e in list.
If it is in list, it returs true otherwise false

3. get(int index):
this return element at index \'index\'

4. indexOf(E e):
this return index of element e in list if it is in list.
Otherwise it return -1

5. remove()
it removes last element from list

6. remove(int index)
it delete element at index \'index\'

7. set(int index, E e):
it replaces element at index \'index\' with element e
.

Explain the function of the following methods in LinkedList 1.
addFirst(E e) 2.
contains(E e) 3.
get(int index) 4. i
ndexOf(E e) 5.
remove() 6.
remove(int index) 7.
set(int index, E e)
Solution
1. addFirst(E e):
It adds an element e at head of linked list

2. contains(E e):
It searches element e in list.
If it is in list, it returs true otherwise false

3. get(int index):
this return element at index \'index\'

4. indexOf(E e):
this return index of element e in list if it is in list.
Otherwise it return -1

5. remove()
it removes last element from list

6. remove(int index)
it delete element at index \'index\'

7. set(int index, E e):
it replaces element at index \'index\' with element e
.

Anuncio
Anuncio

Más Contenido Relacionado

Más de rtodd432 (20)

Más reciente (20)

Anuncio

Explain the function of the following methods in LinkedList 1- addFirs.docx

  1. 1. Explain the function of the following methods in LinkedList 1. addFirst(E e) 2. contains(E e) 3. get(int index) 4. i ndexOf(E e) 5. remove() 6. remove(int index) 7. set(int index, E e) Solution 1. addFirst(E e): It adds an element e at head of linked list 2. contains(E e): It searches element e in list. If it is in list, it returs true otherwise false 3. get(int index): this return element at index 'index' 4. indexOf(E e): this return index of element e in list if it is in list. Otherwise it return -1 5. remove() it removes last element from list 6. remove(int index)
  2. 2. it delete element at index 'index' 7. set(int index, E e): it replaces element at index 'index' with element e

×