Lab 4 Dsa
Lab 4 Dsa
ASSIGNMENT- 4
1. import java.util.Scanner;
class Node {
int data;
Node next;
class LinkedList {
private Node head;
public LinkedList() {
this.head = null;
}
if (head == null) {
head = newNode;
} else {
current.next = newNode;
}
}
linkedList.addNode(data);
}
linkedList.displayList();
scanner.close();
}
}
OUTPUT:
2. import java.util.Scanner;
class SongNode {
String title;
SongNode next;
class Playlist {
private SongNode head;
public Playlist() {
this.head = null;
}
if (head == null) {
head = newSong;
} else {
playlist.addSong(title);
}
playlist.displayPlaylist();
scanner.close();
}
}