시간 복잡도
시간 복잡도

배열 선언
// 타입[] 변수;
int[] intArray;
String[] strArray;
// 타입 변수[];
int intArray[];
String strArray[];
배열 생성
// 값 목록으로 생성
// 타입[] 변수 = {값1 ,값2, ...};
int[] intArray = {1, 2, 3};
// new 연산자로 배열 생성
// 타입[] 변수 = new 타입[길이];
int[] intArray = new int[]5;
요소 얻기
int[] intArray = {1, 2, 3};
// 3번째 값 출력
System.out.println(intArray[2]);
패키지 import
import java.util.LinkedList;
LinkedList 객체 생성
// 타입설정 int 타입만 적재 가능
LinkedList<Integer> list = new LinkedList<>();
// 생성시 초기값 설정
LinkedList<Integer> list2 = new LinkedList<Integer>(Arrays.asList(1,2));
LinkedList 요소 추가 / 삽입
LinkedList<String> list = new LinkedList<>(Arrays.asList("A", "B", "C")));
// 가장 앞에 데이터 추가
list.addFirst("new");
// index 1에 중간 위치에 데이터 10 추가
list.add(1, "new");
// 가장 뒤에 데이터 추가
list.addLast("new");
LinkedList 요소 삭제
LinkedList<String> list = new LinkedList<>(Arrays.asList("A", "B", "C")));
// 첫 번째 값 제거
list.removeFirst();
// index 1 중간 위치 제거
list.remove(1);
// 마지막 데이터 제거
list.removeLast();
// 모든 값 제거
list.clear();
LinkedList 요소 얻기
list.get(0); // 0번째 index 요소의 값 출력