목록Computer Science (44)
Code&Data Insights
- Probability (Number of Cases) - 어떤 일이 일어날 수 있는 모든 경우의 수 (Probability is the branch of mathematics concerning numerical descriptions of how likely an event is to occur, or how likely it is that a proposition is true. ) - 합의 법칙 : 사건 A 또는 사건 B가 일어날 경우의 수 => n(AUB) = n(A) + n(B) - n(A∩B) - 곱의 법칙 : 사건 A와 사건 B가 동시에 일어날 경우의 수 n(AXB) = n(A) X n(B) (1) - 합의 법칙 // 두 개..
자바에서 집합을 사용하기 위한 방법에는 대표적으로 HashSet과 ArrayList를 사용하는 것이 있다. 1. HashSet - 자바에서 Hashset 클래스는 저장을 위한 해시 테이블을 생성하기 위해 사용된다 ( Java HashSet class is used to create a collection that uses a hash table for storage.) - 추상클래스인 AbstractSet class를 상속하고 Set interface를 implements 한다. - HashSet은 Set의 파생클래스로, Set은 중복된 원소를 허용하지 않는 집합이다. * HashSet은 순서,중복을 고려하지 X (1) 집합 사용하기 - HashSet // import java.u..
- Form of a recursive algorithms * Recursive Methods - A method that calls itself is known as a recursive method - Every recursive method must contain one or more : Base Cases, each solving the problem directly : Recursive Cases, each reducing the problem at hand to simpler problems of the same type - A recursive call must : must progress towards the base case : be conditional; otherwise, it lea..
[ Inner Class ] : Inner classes are classes defined within other classes - The class that includes the inner class is called the outer class - There is no particular location where the definition of the inner class (or classes) must be placed within the outer class - Placing it first or last, however, will guarantee that it is easy to find An inner class definition is a member of the outer class..
[ Interface ] : 보안을 위해 interface를 사용한다. ( 특정한 디테일을 숨기고, object의 중요한 디테일만을 보여준다 ) - 인터페이스는 인터페이스로만 상속받을 수 있으며, 클래스와 달리 다중상속을 받는 것이 가능하다 - 추상( abstract) 클래스와 같이 인터페이스는 objects를 생성하는데 쓰일 수 없다. - interface 메소드는 body가 존재하지 X, body는 implement class에서 작성되어진다. - On implementation of an interface, you must override all of its methods - Interface methods are by default, abstract and public - Interface att..
[ Thread ] - 한 프로세스 내에서 멀티 태스킹을 할 수 있도록 만들어진 프로세스를 스레드(Thread)라고 하며, 멀티 태스킹이 가능한 이유는 Multi Thread 때문이다. - A thread of execution in a program ( kind of like a virtual CPU ) - The JVM allows an application to have multiple threads running concurrently - Each thread can execute parts of your code in parallel with the main thread * Each thread has a priority ( 모든 쓰레드에는 각각 우선순위가 있다 ) -> Threads with ..
[ Generic ] : 클래스 내부에서 지정하는 것이 아닌 외부에서 사용자에 의해 지정되는 것. : 컬렉션 프레임 워크에서 많이 사용되어짐 - Generics add that type of safety feature. - Generics are used in HashSet / ArrayList / HashMap - The syntax of generic * To create an instance of generic class * BaseType obj = new BaseType () * We cannot use primitive data types like int, char - Type Parameters in Java Generics -> T : Type -> E : Element -> K : Key..
* Java.lang .objects method : equals / toString() / clone() * Object class - 모든 클래스의 최상위 클래스 - java.lang.Object - 모든 클래스는 object 클래스의 method를 사용할 수 있음 *Hashcode - return : jvm(java virtual machine)이 저장한 인스턴스의 주소값을 10진수로 나타냄 - 서로다른 메모리의 두 인스턴스가 같다면? : equals() - true : 동일한 hashcode() return 값을 가져야함.