22-Array List and Linked List Practice Examples

Опубликовано: 11 Июль 2026
на канале: yogiblrithub
70
1

1. Basic Operations with ArrayList :
Task: Create an ArrayList of integers and perform the following operations:
Add elements 10, 20, 30, 40, 50 to the list.
Remove the element at index 2.
Update the element at index 3 to 60.
Check if the list contains 20.
Print the size of the list.
Iterate through the list and print each element.



2. Basic Operations with LinkedList :
Task: Create a LinkedList of strings and perform the following operations:
Add elements "Apple", "Banana", "Cherry", "Date", "Elderberry" to the list.
Add "Fig" to the beginning of the list.
Remove the element "Cherry".
Retrieve but do not remove the first and last elements of the list.
Print the size of the list.
Iterate through the list in reverse order and print each element.