CODE:
import java.util.Scanner;
import java.util.LinkedList;
public class LinkedList1Demo
{
private LinkedList<String> s;
public static void main(String[] args)
{
LinkedList1Demo hScore = new LinkedList1Demo();
Scanner scanner = new Scanner(System.in);
while (true)
{
try
{
System.out.print("Enter the name (Or) -1 to quit: ");
String name = scanner.nextLine();
if ("-1".equals(name))
{
break;
}
System.out.print("Enter the high score:");
String score = scanner.nextLine();
hScore.insert(name, Integer.parseInt(score));
}
catch (Exception le)
{
System.out.println("Invalid data "+le);
le.printStackTrace();
}
}
System.out.println("High scores order:");
System.out.println(hScore.toString());
}
public LinkedList1Demo( )
{
s= new LinkedList<String>();
}
public void insert(String name, Integer score)
{
String newScore = name + " " + score.toString();
if (s.isEmpty( ))
{
s.add(newScore);
return;
}
for (int i = 0; i <= s.size(); i++)
{
if (i == s.size())
{
s.add(newScore);
break;
}
if (isCheck(newScore, s.get(i)))
{
s.add(i, newScore);
break;
}
}
while (s.size() > 10)
{
s.remove(10);
}
}
public boolean isCheck(String high, String low)
{
Integer highScore =
Integer.parseInt(high.substring(high.lastIndexOf(' ')+1));
Integer lowScore = Integer.parseInt(low.substring(low.lastIndexOf('
')+1));
return highScore > lowScore;
}
public String toString()
{
String sList = "";
for (int i = 0; i < s.size(); i++)
{
sList = sList + s.get(i) + "\n";
}
return sList;
}
}
Output:

Implement an application based on a singly linked list that maintains a list of the top...
JAVA please Java problem that has to be in doubly linked list. It is game problem that I have to keep of the players' scores. this should have a Java blueprint class named player It should have two fields, the name and score and include the constructors, toString() method, and getters and setters. Scores must be kept in ascending order (smallest at the front ) in a doubly linked list. It has menu as well: Load original data Print the...
C# is the language Create a generic class called “LinkedList” and implement the singly linked list. Implement the following functions: - In C# Function Name Function Parameters Description Empty - Return true if empty else return false. Size - Return the current size of the list. Insert Value Insert the Value at the end of the list. Insert Index, Value Insert the Value at the specified Index. If the Index is out of range then insert the Value at the...
use python
In class, we've studied Singly-Linked Lists which are made of nodes that point at subsequent nodes. One of the biggest annoyances with Linked Lists is the difficulty of going backwards through a list (such as getting the previous node or traversing the list backwards). An intuitive solution to this inefficiency is the doubly-linked list, which adds pointers to previ- ous nodes. Doubly-Linked Lists are not very different from Singly-Linked Lists, but are far more common because they are...
use python
In class, we've studied Singly-Linked Lists which are made of nodes that point at subsequent nodes. One of the biggest annoyances with Linked Lists is the difficulty of going backwards through a list (such as getting the previous node or traversing the list backwards). An intuitive solution to this inefficiency is the doubly-linked list, which adds pointers to previ- ous nodes. Doubly-Linked Lists are not very different from Singly-Linked Lists, but are far more common because they are...
use python
In class, we've studied Singly-Linked Lists which are made of nodes that point at subsequent nodes. One of the biggest annoyances with Linked Lists is the difficulty of going backwards through a list (such as getting the previous node or traversing the list backwards). An intuitive solution to this inefficiency is the doubly-linked list, which adds pointers to previ- ous nodes. Doubly-Linked Lists are not very different from Singly-Linked Lists, but are far more common because they are...
Given a singly-linked list interface and linked list node class, implement the singly-linked list which has the following methods in Java: 1. Implement 3 add() methods. One will add to the front (must be O(1)), one will add to the back (must be O(1)), and one will add anywhere in the list according to given index (must be O(1) for index 0 and O(n) for all other indices). They are: void addAtIndex(int index, T data), void addToFront(T data), void addToBack(T...
how to implement a linked list object using only singly linked list toolkit. Then implement a FREQUENCY function to count the ovcurrence of each element in the list. task#1: Add = operator to node: implement the assignment operator for the node such that setting a node = overwrites the value in the node with the value. task#2:Linked List class implement the methods of linked list. insert search and locate remove node* operator [] task#3: Implement the Frequency
ANSWER IN JAVA ASAP 1.Implement a stack on the singly linked list with the operations of Lab Assignment 1. Hint: Using the same Stack class you implemented, change the array to an object of the singly linked list class. The functionality of push and pop is now based on the methods of the linked list class.
Q.(1)Describe the algorithm and java implementation for the following operations A. Create a singly linked list L1 with 4 nodes. You can use insert operation to add nodes to the list. Each element represent an airport code (e.g. BOS, ATL, JFK, MSP, etc.). Display the list L1 after it is created. B. Given singly linked list L1, create another singly linked list L2 that contains the same elements but in the reverse order. Display the content of both L1 and...
In NetBeans Create a new Java Application to manage Linked Lists: (Note: Do not use java.util.LinkedList) a) Create a DateTime class 1. Add day, month, year, hours, minutes as attributes 2. Add a constructor and a toString() method 3. Implement the Comparable interface, and add a CompareTo() method 4. Add methods to get and set all attributes. b) Add to MyLinkedList class the following methods: 1. Insert a Node to a particular position in the List 2. Insert a Node...