首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

小弟我的程序如何错了,给指点一下

2012-02-17 
我的程序怎么错了,给指点一下publicvoidselectionSort()throwsException{queuetheQnewqueue(4)inta0fo

我的程序怎么错了,给指点一下
public   void   selectionSort()   throws   Exception
{       queue   theQ=new   queue(4);
                int   a=0;
               
    for   (int   mark=0;   mark <used-1;   mark++)
                  {
                              int   minIndex   =   findMin(mark);
                        swap(mark,   minIndex);
                            theQ.append(a++);
                            counterA=theQ.serve()+1;
                                  }
         
                System.out.println(counterD+ "     "+counterB+ "   "+counterC+ "   "+counterA);
                  }
             
            private   int   findMin(int   mark)
          {         queue   theQ1=new   queue(4);
                 
                  int   b=0;
                  int   d=0;
                        int   posmin=mark;
                  try{     for   (int   i=posmin+1;   i <used;   i++)
                          if(theList[i] <theList[posmin])
                            {     posmin=i;
                     
                                theQ1.append(b++);
                                counterB=theQ1.serve()+1;
                        }
                          theQ1.append(d++);
                          counterD=theQ1.serve()+1;
                        }
                              catch(Exception   e){};
                              return   posmin;
                }
                public   void   insertionSort()   throws   Exception


                {  
                          queue   theQ=new   queue(4);
                          theQ.reset();
                          int   c1=0;
                      int   b1=0;
                        int   d1=0;
                    for(int   mark=1;mark <used;mark++)
                        {  
                                int   temp=theList[mark];
                                int   i=mark-1;
                                while(i> =0&&theList[i]> temp)
                                {  
                                        theList[i+1]=theList[i];
                                               
                                            theQ.append(b1++);
                              counterB=theQ.serve()+1;
                                        i--;
                                }
                             
                                theList[i]=temp;
                                      theQ.append(c1++);
                              counterC=theQ.serve()+1;
                               
                        }
                          theQ.append(d1++);
                          counterD=theQ.serve()+1;
                                  System.out.println(counterD+ "     "+counterB+ "   "+counterC+ "   "+counterA);
                }


我想知道这两种sort   有多少Iteration   |   Comparisons   |   Copies   |   Swaps高手给我看看吧

[解决办法]
up for u
[解决办法]
请你显示错误原因,抛什么异常
[解决办法]
把抛的异常贴出来阿,大伙儿帮你看看
[解决办法]
public void selectionSort() throws Exception
{ queue theQ=new queue(4);
int a=0;

for (int mark=0; mark <used-1; mark++) // used 这个变量在哪定义的?

[解决办法]
就是,把错误信息贴上来啊

热点排行
Bad Request.