-3
public class NIS {
public static void insertSort(int[] A)
{
for(int i = 1; i < A.length; i++)
{
int value = A[i];
int j = i - 1;
while(j >= 0 && A[j] > value)
{
A[j + 1] = A[j];
j = j - 1;
}
A[j + 1] = value;
}
}
public static void main(String[] args) {
int a[]={20,10,2,100,1};
insertSort(a);
for (int i=0 ; i <a.length ; i++)
{
System.out.println(" "+a[i]);
}
// in this code there are many problems if anyone of you can help me so plz debugg this code.
}
}
你可以像这样运行它:1)'javac -cp。 NIS.java' 2)'java NIS' –
请在查询这个URL之前询问任何问题:http://stackoverflow.com/help/how-to-ask –
欢迎来到Stack Overflow! “寻求调试帮助的问题(”为什么这个代码不工作?“)必须包含所需的行为,特定的问题或错误以及在问题本身中重现问题所需的最短代码。没有明确问题陈述的问题对其他读者无益。“引自[我可以在这里询问什么主题?](http://stackoverflow.com/help/on-topic)。 –