분류 전체보기 (347) 썸네일형 리스트형 Java Strings Tutorial package String; public class Main { public static void main(String[] args) { // two ways of initializing String String myString = new String("i love java"); String myString2 = "i love java"; if(myString.equals(myString2)) { System.out.println("strings are equal"); } System.out.println(myString.length()); System.out.println(myString.charAt(5)); System.out.println(myString.indexOf('o')); String st.. 백준 11654 자바 문제 아스키코드 변환 charAt은 int 인덱스를 지정할 수 있는 메소드다. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.next().charAt(0); System.out.println(a); } } charAt(0)이란 바로 첫번째 문자열만을 가져오겠다는 의미다. int a = sc.next().charAt(0); 그러니까 이 코드는 풀이하면, int a 라는 변수에 커맨드에서 입력될 문자열의 첫번째 문자를 대입하겠다는 것이다. charat은 string에서 문자를 가져오고 싶을 때 사용한다. 이 문제의 경우 입력이 숫자 0-.. ASCII(아스키 코드)란? 아스키란 미국 국립 표준 협회에서 표준화한 정보교환용 7비트 부호체계이다. 인간이 입력한 문자를 컴퓨터가 이용할 수 있는 신호로 바꾸어주는 것을 인코딩이라고 한다. 복잡한 신호를 0과 1이라는 디지털 신호로 변환하는 과정이다. 하지만 아스키는 2바이트 이상의 다양한 코드들을 표현할 수 없어서 현대에는 유니코드를 더 많이 사용한다. Baekjoon 10870 Java Recursive Fibonacci number // Recursive method for getting the fibonacci number for N public static int Fibonacci(int N) { if(N == 0) return 0; if(N == 1) return 1; return Fibonacci(N-1) + Fibonacci(N-2); } import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); System.out.println(Fibonacci(N)); } // Recursive method for getting the .. Baekjoon 10872 java factorial Recursive means, on a computer, repeatedly referring to yourself. Because it calls method inside the method, there are some problems to consider. If the recursive call becomes too repetitive, that is, when the recursive deepens, Java spits out an error called Stack Overflow. In the case of a recursive function, it eventually takes up a huge amount of memory because it is stacked in memory as muc.. Java Regression problem I was trying to solve a regression problem from baekjoon algorithm., I was a little lazy studying these days, not because I am already good at it, but I met many people. I met two geniuses who are naturally smart enough to get the first status in their career. They were both younger than me but achieved so many competitive skills and philosophical thoughts. Even though they were younger, I calle.. List data structure 배열과 리스트의 차이 Array와 List는 상당히 비슷하지만, Array보다 List의 기능이 좀 더 많다고 할 수 있다. 어레이는 인덱스가 중요하다. 리스트는 데이터의 저장 순서가 더욱 중요하다. 데이터의 추가 원본 데이터에서 3번 인덱스에 50이라는 데이터를 추가하게 되면, 배열의 경우는 정해진 사이즈가 있기 때문에 40이라는 데이터가 대체되어버리지만, 리스트의 경우는 새롭게 데이터가 추가가 되고, 기존의 인덱스3의 데이터는 뒤로 밀려나게 된다. 데이터의 삭제 마찬가지로 배열의 경우는 정해진 공간이 있기 때문에 데이터는 사라지더라도 인덱스는 유지가 되지만, 리스트의 경우는 인덱스와 함께 데이터가 사라진다. 데이터 구조의 본질 데이터구조의 기능과 동작방법을 아는 것이다. 리스트의 기능 처음, 끝, 중.. Linked list 단방향 양방향 linked list는 데이터가 연결되어 있는 형태의 정해지지 않는 데이터구조이다. 단방향 Linked list one way 이 경우는 주소가 전 단계에만 등록이 되어 있기 때문에 다음 데이터에 대해서만 정보를 알 수가 있을 뿐 앞에 있는 데이터를 알 수는 없다. 그러니까 데이터를 불러오려면 맨 처음 데이터부터 항상 불러와야 한다는 것이다. 양방향 linked list 양방향 링크드 리스트의 경우는 이와 같이 전 단계 데이터주소를 가지고 있다. 이전 1 ··· 16 17 18 19 20 21 22 ··· 44 다음