• Post Reply Bookmark Topic Watch Topic
  • New Topic

Index Array sorting for a Linked List  RSS feed

 
Ellie Barnes
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to use an index array in conjunction with a linked list of CD items (the CD class contains an Artist, Title, no. Tracks and a unique identifier number (from 0). My method for sorting the linked list by generating an index array of whatever the current size of the linked list is below. It compiles and runs fine, but does not sort :roll:



The CD.compareartist method is:



Thank you to anyone who can help me with this, as I am stumped, and about to use my usual method of solving these problems, and starting again!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

First of all, you should tell us: is this a class assignment where you've definitely been asked to write your own linked list, and you own sort routine, and more or less told to deliberately asked to avoid the java.util package? Because there are tools there that would let you avoid writing all of this code otherwise.
 
Ellie Barnes
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Mmm yeah, this is a project on a course I'm doing on data structures and algorithms, so we're supposed to write our own (and I realise that asking on a web site is not writing my own but hey!).

Thanks

Ellie
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!