Results 1 to 2 of 2
Thread: Sorted LinkList problem
- 08-07-2009, 07:41 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 1
- Rep Power
- 0
Sorted LinkList problem
I need to write a Recursive function L.insert(item) which inserts integer item it its correct position in L.So,if L is initially empty,the pseudocode below :
inputs = {10,20,-8,7,12}
Create an empty List
while(there is input)
{
Read item
L.insert(item)
}
should create sorted list as follows
L = {-8,7,10,12,20 }
I don' know how to sort a Linked list.
Please can anybody help me out
- 08-08-2009, 06:49 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
use Collections.sort
Similar Threads
-
Help with Code! Display Array of Strings and Integers - Sorted
By luvjoynt in forum New To JavaReplies: 7Last Post: 04-28-2008, 04:28 AM -
how to right a program that find kth number in two sorted array?
By fireball2008 in forum New To JavaReplies: 8Last Post: 04-22-2008, 03:21 AM -
How to create a Sorted List in Java
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 10:31 PM -
Sorting, Searching, and Inserting into a sorted array
By Java Tip in forum java.langReplies: 0Last Post: 04-14-2008, 08:39 PM -
My doublyLinked list does not get sorted
By hasani6leap in forum New To JavaReplies: 0Last Post: 01-06-2008, 03:09 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks