전체 글 300

[Java] Abstract Data Type(ADT)

ADT(추상 자료형)은 직접적인 기능의 완성이 아닌 해당 자료형이 어떤 기능을 하는 것인지를 나타낸다. Stack을 예로 들면, Stack은 Last In First Out(LIFO) 방식으로 동작하지만, 이는 Array나 Linked List와 같은 자료 구조(Data Structure)를 선택적으로 활용해 구현될 수 있다. 또한 Stack의 size를 반환(return)하는 함수가 Stack의 첫 번째 원소부터 하나씩 숫자를 세는 것인지, 마지막 원소부터 세는 것인지, size 변수가 존재해 원소가 추가될 때 마다 기록한 값을 반환하는 것인지는 어떻게 구현을 하느냐에 따라 달라질 수 있다. 참고 - https://gbsb.tistory.com/306

[Algorithm] Connected Graph

정의(Definition) : A connected graph is a graph that is connected in the sense of a topological space, i.e., there is a path from any point to any other point in the graph. A graph that is not connected is said to be disconnected. This definition means that the null graph and singleton graph are considered connected, while empty graphs on n>=2 nodes are disconnected. : Connected Graph(연결 그래프)는 위상 ..

[Java] Helper method(헬퍼 메소드)

Wikipedia definition(위키피디아 정의) :In object-oriented programming, a helper class is used to assist in providing some functionality, which isn't the main goal of the application or class in which it is used. An instance of a helper class is called a helper object (for example, in the delegation pattern). :객체 지향 프로그래밍에서 헬퍼 클래스는 어떤 기능을 제공하기 위해 사용되는 클래스로 어플리케이션이나 클래스의 주 목적으로 사용되는 것이 아니다. 헬퍼 클래스의 인스턴스는..

[Tech, etc.] Heapify(힙 생성)

Heapify :Heapify is the process of creating a heap data structure from a binary tree represented using an array. : Heapify란 배열(Array)로 표현된 이진 트리(Binary tree)의 자료구조를 갖는 힙(Heap)을 생성하는 과정이다. 알고리즘 과제로 Heap을 Build하는 문제에 대해 알고리즘을 제시해야했고, 목표 시간복잡도(Time-Complexity)는 Linear time(O(n))이었다. Heap을 접할 때 기본적으로 함께 알게 되는 함수 중 하나가 Insert() 함수다. Insert() 함수의 시간복잡도는 Tree의 Height(높이)만큼 비교가 필요해 O(log n)이다. 이를 n개의 노드..

[Tech, etc.] Minimum Spanning Tree(MST, 최소 신장 트리)

MST를 알아보기에 앞서 Spanning Tree에 대해 알아보자. Wikipedia에 따르면 Spanning Tree에 대한 정의는 아래와 같다. In the mathematical field of graph theory, a spanning tree T of an undirected graph G is a subgraph that is a tree which includes all of the vertices of G. In general, a graph may have several spanning trees, but a graph that is not connected will not contain a spanning tree (see spanning forests below). If all of..

[Tech, etc.] Boilerplate code(상용구 코드)

In computer programming, boilerplate code, or simply boilerplate, are sections of code that are repeated in multiple places with little to no variation. When using languages that are considered verbose, the programmer must write a lot of boilerplate code to accomplish only minor functionality. : 컴퓨터 프로그래밍에서 boilerplate code(boilerplate, 상용구 코드)는 여러번 반복되지만 수정이 거의 없거나 아예 없는 코드를 말한다. 장황하다고 생각되는 언어를..

기술(Tech, IT) 2022.10.08

[Python] Two-Dimensional Array(2차원 배열)

매번 파이썬 2차원 배열 선언이 헷갈린다. 2차원 배열 선언은 아래와 같고, Shallow Copy(얕은 복사)를 주의해야한다. 우선 Shallow Copy를 고려하지 않은 일반적인 2차원 배열은 아래와 같이 선언한다. Array = [[0 for column in range(9)] for row in range(9)] 혹은 아래와 같이 선언할 수 도 있다. Array = [[0] * 9] for row in range(9)] 다음은 Shallow Copy를 적용한 2차원 배열 선언이다. Array = [[0] * 9 * 9] 위와 같이 2차원 배열을 선언할 경우, [0] * 9라는 배열을 그대로 복사해 생성하는 것으로 Array[0][0]의 값을 변경할 경우 Array[1][0]부터 Array[8][0..

[Tech, etc.] Higher order function(고차 함수)

한 블로그에 따르면 Higher order function에 대한 설명은 아래와 같다. A higher order function is a function that takes a function as an argument, or returns a function. Higher order function is in contrast to first order functions, which don't take a function as an argument or return a function as output. : 고차 함수는 인자로 함수를 가지거나 함수를 반환하는 함수이다. 고차 함수의 반대는 first order functions으로 함수를 인자로 가지거나 함수를 반환하지 않는다. Java의 관점에서 Hi..