protected void sortHorseList(int iHorseCount)
{
int i = 0;
Horsie currentNode = head;
Horsie auxNode = new Horsie();
boolean foundChange = true;
while(foundChange)
{
foundChange = false;
for(i=0; i<iHorseCount-1; i++)
{
if (currentNode.getHorseValue() > currentNode.getNext().getHorseValue())
{
auxNode.setHorseValue(currentNode.getHorseValue());
currentNode.setHorseValue(currentNode.getNext().getHorseValue());
currentNode.getNext().setHorseValue(auxNode.getHorseValue());
foundChange = true;
}
currentNode = currentNode.getNext();
}
}
}
이 코드 표시 널 포인터 오류 메인 프로그램을 실행. 나는 데이터 구조에 초보자이며, 나는 당신들의 도움을받는 사람들과 함께이 문제를 해결하기를 희망하고있다! 제발 가르쳐주세요 사용법 버블 정렬이중 연결 목록 ... HEEELP!버블 정렬 - Null 포인터 오류
관련 프로그래밍 언어로 태그하십시오. –
NullPointerException을 throw하는 행은 어느 것입니까? – RyPope
숙제? 아무도 연결 목록을 정렬하지 않으며 아무도 학계 밖에서 버블 정렬을 사용하지 않습니다. – EJP