nothing
This commit is contained in:
parent
341bea3c16
commit
e7684dedcd
1 changed files with 17 additions and 16 deletions
|
@ -81,6 +81,23 @@ public class Link
|
|||
return new Link(obj);
|
||||
}
|
||||
|
||||
public Link sort()
|
||||
{
|
||||
Link newCabeza = (Link) clone(), next = next(), newLink;
|
||||
while (next!=null)
|
||||
{
|
||||
newLink = (Link) next.clone();
|
||||
if (newLink.toString().compareTo(newCabeza.toString())<=0)
|
||||
{
|
||||
newLink.siguiente = newCabeza;
|
||||
newCabeza = newLink;
|
||||
}
|
||||
else newCabeza.insertSorted(newLink);
|
||||
next = next.next();
|
||||
}
|
||||
return newCabeza;
|
||||
}
|
||||
|
||||
public void insertSorted(Link link)
|
||||
{
|
||||
if (siguiente==null)
|
||||
|
@ -94,20 +111,4 @@ public class Link
|
|||
else siguiente.insertSorted(link);
|
||||
}
|
||||
|
||||
public Link sort()
|
||||
{
|
||||
Link newCabeza = (Link) clone(), next = next(), newLink;
|
||||
while (next!=null)
|
||||
{
|
||||
newLink = (Link) next.clone();
|
||||
if (newLink.toString().compareTo(newCabeza.toString())<=0)
|
||||
{
|
||||
newLink.siguiente = newCabeza;
|
||||
newCabeza = newLink;
|
||||
}
|
||||
else newCabeza.insertSorted(newLink);
|
||||
next = next.next();
|
||||
}
|
||||
return newCabeza;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue