Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Mergesort referencing Comparable objects

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok here is what i have to do -

I need to complete and test class SortLinkedList below which is intended to perform a mergesort on a linked list of LinearNodes referencing Comparable objects, by providing code to:

Complete the method printList which outputs the list to the output file.

Complete the recursive method countList which counts the number of items on the list

Complete the code for method LinkedMergeSort as indicated


Here is my code:



Thanks for any help anyone can give me. Joe.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds like an assignment that you should be doing, so any help provided here will be general in nature.

public static void printList(LinearNode L)
{
// how do i output the list to the file here??}

public static int countList(LinearNode L)
{
// how do i count the number of items on the list here
// using a recursive method??
}


The answer to this depends on what class LinearNode is and does, about which we know nothing. Have you checked its API to see if there may be helpful methods in it?
 
reply
    Bookmark Topic Watch Topic
  • New Topic