Built in Linked List Problems
Using :
private LinkedList<Integer> links = new LinkedList<Integer>();
Write the Following
-
public int count( int num)
//Count the number of times a particular int is in the list
-
public Integer smallest()
//return the smallest number in the list
-
public int biggest()
//return the biggest number in the list
-
public void insert(int n)
//insert number into an ascendingly ordered Linked List
// precondition : the list is sorted in ascending order
-
public Integer removeSmallest()
//return the smallest number in the list
-
public boolean removeNum(int num)
//remove first occurrence of a number if there
-
public void printReverse()
// print list in reverse order
-
public void removeDuplicates()
// remove any duplicates
-
public void move()
// move first node in list to the end
-
public void reverse()
//reverse the list
-
public LinkedList reverse()
//return a new reversed list - don't disturb original
-
int switcheveryother()
// switch every other element
// 1 3 8 5 3 9 -> 3 1 5 8 9 3