Skip to content

anuragjain-git/SingleLinkedList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

SingleLinkedList

Single Linked List using java collection

View code for these operations and its running time.

  • Insertion
  • Deletion
  • Sorting
  • Arranging

Sample Output :

Total number of input : 10
Enter 10 elements : 8 4 7 -2 7 4 -1 0 6 2
User Inputs are [8, 4, 7, -2, 7, 4, -1, 0, 6, 2]
Do you want to reverse ? Y/N : y
Reverse linkedlist is [2, 6, 0, -1, 4, 7, -2, 7, 4, 8]
Do you want to reverse ? Y/N : n
Do you want to insert ? Y/N : y
Enter index to insert : 0
Enter elements to insert : 0
Do you want to insert ? Y/N : y
Enter index to insert : 1
Enter elements to insert : 1
Do you want to insert ? Y/N : n
Do you want to Print LinkedList ? Y/N : y
linked list : [0, 1, 2, 6, 0, -1, 4, 7, -2, 7, 4, 8]
Do you want to sort ? Y/N : y
Sorted linked list is [-2, -1, 0, 0, 1, 2, 4, 4, 6, 7, 7, 8]
Do you want to remove at any index ? Y/N : y
Enter index to remove : 11
New linked list is [-2, -1, 0, 0, 1, 2, 4, 4, 6, 7, 7]
Do you want to remove at any index ? Y/N : n
Do you want to remove first occurance of an element ? Y/N : y
Enter element to remove : 4
New linked list is [-2, -1, 0, 0, 1, 2, 4, 6, 7, 7]
Do you want to remove first occurance of an element ? Y/N : n
Do you want to an remove all occurance of an element? Y/N : y
Enter element to remove: 0
After removing [-2, -1, 1, 2, 4, 6, 7, 7]
Do you want to an remove all occurance of an element? Y/N : n
Do you want to Print LinkedList ? Y/N : y
linked list : [-2, -1, 1, 2, 4, 6, 7, 7]
Do you arrange elements in decreasingEvenPosition and increasingOddPosition? Y/N : y
Odd inc, Even dec position[-2, 7, 1, 6, 4, 2, 7, -1]

About

Code for Single LinkedList using java collections

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages