본문 바로가기

전체 글

(212)
네트워크 플로우(Network Flow) 및 이분 매칭(Bipartite Matching) 네트워크 플로우 : 특정 지점에서 다른 지점으로 데이터가 얼마나 흐르고 있는가를 측정하는 알고리즘, 최대 유량이라고도 한다. 남아있는 모든 가능한 경로를 찾아내기 위해 음의 유량에 대해서도 계산한다. 참고 사이트 : https://blog.naver.com/ndb796/221237111220 27. 네트워크 플로우(Network Flow) 네트워크 플로우(Network Flow)는 특정한 지점에서 다른 지점으로 데이터가 얼마나 많이 흐르고 있는가를... blog.naver.com 이분 매칭 : 두 개의 집단에서 최대로 매칭시키는 방법을 구하는 방법이다. 깊이 우선 탐색(DFS)를 통해 다른 대체제가 있는지 확인하여 대체제가 있다면 바꾸는 방법으로 최대한 많이 매칭되도록 만들 수 있다. 참고 사이트 : h..
Merge Sort 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 public class Main { public static int[] src; public static int[] tmp; public static void main(String[] args) { src = new int[] { 1, 8, 5, 4, 2, 3, 7, 6 }; tmp = new int[src.length]; printArray(src); mergeSort(0, src.length - 1); printArray(src); } public static void mergeSort(int sta..
없어진 기록 찾기 1 select animal_id, name from animal_outs where animal_id not in (select animal_id from animal_ins); cs not in을 사용하여 간단히 해결하였다.
다단계 칫솔 판매 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647import java.util.*;class Solution { static HashMap map = new HashMap(); static ArrayList list = new ArrayList(); static void moneyCal(String seller, int money) { Persons person = list.get(map.get(seller)); int remain = (int) (money * 0.1); person.profit += money - remain; // 추천인이 없거나 배분 금액이 없을 경우 종료 if(person.re..
네트워크 1234567891011121314151617181920212223242526class Solution { static boolean visited[]; public static void DFS(int pos, int n, int[][] computers) { if(visited[pos]) return; visited[pos] = true; for(int i=0;i
헤비 유저가 소유한 장소 1 2 select id, name, host_id from places where host_id in (select host_id from places group by host_id having count(*) >= 2) order by id; cs 서브쿼리를 사용하는 문제이다.
있었는데요 없었습니다 1 2 select i.animal_id, i.name from animal_ins i, animal_outs o where i.animal_id = o.animal_id and i.datetime > o.datetime order by i.datetime; cs join 및 시간을 비교하는 구문을 사용하였다.
중성화 여부 파악하기 1 select animal_id, name, if(sex_upon_intake like '%neutered%' or sex_upon_intake like '%spayed%', 'O', 'X') from animal_ins; cs if문 사용에 관한 문제였다.