hello everybody.. im new here and new to java :)
please help with your expertise
i need to sort an array of string objects..by lexicographical order.
by method compareTo() only.
cant use array.sort() and such.
if i have several words in the array. and i need to enter a new word that is lexicographicaly lower from one of the words, how do i make room for it ,move the rest, and put it in the right spot..
i tried bubblesort and it didn\t help..
plz show me an example of sorting from this kind.
forever grateful
[code]
public boolean addWord(Word newWord){
boolean work = true;
if (_dic[firstEntry] == null){
_dic[firstEntry] = new Word (newWord.getHebrewWord(),newWord.getEnglishWord()) ;
//firstEntry++;}
for (;move<firstEntry;move++)
if (_dic[move].getEnglishWord().compareTo(newWord.getEnglishWord ())<0){
firstEntry++;
//_dic[move] =_dic[move+1];
_dic[firstEntry-11] = new Word (newWord.getHebrewWord(),newWord.getEnglishWord()) ;}
work = true;
}
return work;
}
[/CODE