목록Algorithm-이론 (7)
HS_development_log
1. String String은 Reference type. 즉, 객체입니다. 따라서 int, double 같은 기본 타입 변수와 달리 wrapper 클래스를 사용하지 않아도 메서드 사용이 가능합니다. 2. String 객체의 주요 메서드 * 시간 복잡도 : 문자열의 길이를 n이라 할 때, O(N). 밑에 후술 할 모든 메서드에 해당합니다. - String.replace() String str = "abcdef"; str = str.replace("abc","123"); System.out.println(str); // 출력 : 123def String.replace 메서드는 인자로 "변경당할 문자열", "변경할 문자열"을 받은 뒤 그 결과를 String 객체로 반환합니다. - String.toUpper..
1. Wrapper Class란? 자바의 자료형 - 기본 타입(primitive type) : byte, char, int, float, double, long, short ... 등등 - 참조 타입(reference type) : Class, Interface 등.. 이때 기본 타입인 char, int, float 등을 객체로 다루기 위해서 사용하는 클래스를 Wrapper class 라고 합니다. 기본 타입(primitive type) 래퍼 클래스(Wrapper class) byte Byte char Character int Integer float Float double Double boolean Boolean long Long shor Short 2. Number - Integer - Integer..
출처 : https://gist.github.com/psayre23/c30a821239f4818b0709 Runtime Complexity of Java Collections Runtime Complexity of Java Collections. GitHub Gist: instantly share code, notes, and snippets. gist.github.com
가장 큰 증가하는 부분 수열을 구하는 알고리즘이다. 예를들어 10 30 50 40 20 이라는 배열이있을때 10 30 50 이 가장큰 증가하는 부분수열이며 길이는 3이다 길이를 구하는 알고리즘과 요소까지 다구하는 알고리즘은 차이가 좀 있는데 2개다 밑에 설명할 것이다. 1. LIS의 길이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 import java.util.*; public class LIS_length { public static void main(String[] args) { Scanner scan =..