Overview
- what is a list?
- what is a node
- Singly linked lis
- SLL ADT
- Array vs Dynamic Array vs SLL
What Is A List ?
- List is a linear collection of data items also known as List item
Example 1:
- Marks of tests | List of marks ( list item:int)
20 15 21 24 18 23 25….
Example 2:
- List Of Guests ( list item:string)
“Singh”,”chaturvedi”,”Dubey”,”khan”…..
Example 3:
- List Of Students ( list item:student)
Rahul | Savita | dilip
17 | 19 | 18
xyz@x.com | xy@x.com | x@x.com………
Singly Linked List
- A singly linked list is a type of linked list where each node in the list points to the next node in the sequence. The last node points to null, indicating the end of the list. Singly linked lists are relatively simple and can be implemented efficiently. However, they do not support backward traversal.
- Here is a simple implementation of a singly linked list in Java:
What Is A Node ?
Example 1:
- Marks of tests | List of marks ( int item;)(node next;)
20 15 21 24 18 23 25….
node start = new node();
Singly Linked List
Insertion:
- starting
- Last
- after a node
deletion:
- first note
- Last node
- Specific node
Array vs Dynamic Array vs SLL
Array:
- fixed Size
Dynamic Array:
- growable
- Shrinkable
SLL:
- Dynamic
- growable
- Shrinkable