편집 기록

편집 기록
  • 프로필 정영훈님의 편집
    날짜2018.03.16

    자바 배열안에 임의의 값 입력하고 삭제하는 방법...


    public static int ListInsertDeletetCount(int []array){
     int count = 0;
     Random rnd = new Random();
         for(int i=0; i<100; i++){
            int dst = rnd.nextInt(list.length-1);
            for(;;) {
               //dst 위치에 dst 숫자 삽입
             count++;
           }
            int dat = rnd.nextInt(list.length-1);
            for(;;){
               //dst 위치에서 삭제
            count++;
           }
       count = count / 200;
       return count;
    }
    

    코드는 위와 같은데용 랜덤한 배열 위치에 랜덤한 값을 입력하고 삭제하고를 반복하는 건데 삽입은 list[dst] = dst; 가 아닌가요? 계속해서 에러가 뜨네요 ㅠㅜ 삭제는 뭔지 감이 안와서.. remove 로도 해결이 안되서 여쭤봅니다.

  • 프로필 알 수 없는 사용자님의 편집
    날짜2018.03.15

    자바 배열안에 임의의 값 입력하고 삭제하는 방법...


    public static int ListInsertDeletetCount(int []array){ int count = 0; Random rnd = new Random(); for(int i=0; i<100; i++){ int dst = rnd.nextInt(list.length-1); for(;;) { //dst 위치에 dst 숫자 삽입 count++; } int dat = rnd.nextInt(list.length-1); for(;;){ //dst 위치에서 삭제 count++; } count = count / 200; return count; }

    코드는 위와 같은데용 랜덤한 배열 위치에 랜덤한 값을 입력하고 삭제하고를 반복하는 건데 삽입은 list[dst] = dst; 가 아닌가요? 계속해서 에러가 뜨네요 ㅠㅜ 삭제는 뭔지 감이 안와서.. remove 로도 해결이 안되서 여쭤봅니다.