E D R , A S I H C RSS

알고리즘8주숙제

Greedy

1. Friendly Coins

Given the denominations of coins for a newly founded country, the Dairy Republic, and some monetary amount, find the smallest set of coins that sums to that amount. The Dairy Republic is guaranteed to have a 1 cent coin.

2. 0/1 knapsack

Give a greedy method, which is heuristic, to solve the 0/1 knapsack problem and also give an example to show that it does not always yield an optimal solution.

3. kanpsack

The kanpsack problem is defined as follows:
Given positive integers P<sub>1</sub>, P<sub>2</sub>, ..., P<sub>n</sub>, W<sub>1</sub>, W<sub>2</sub>,..., W<sub>n</sub> and M.
Find X<sub>1</sub>, X<sub>2</sub>, ..., X<sub>n</sub>, 0 ≤ X<sub>i</sub> such that
∑P<sub>i</sub>X<sub>i</sub> (1 ≤ i ≤ n) is maximized subject to ∑W<sub>i</sub>X<sub>i</sub> ≤ M (1 ≤ i ≤ n) .
Give a greedy method to find an optimal solution of the knapsack problem and prove its correctness.

4. Job Scheduling

Consider the problem of scheduling n jobs on one machine. Describe an algorithm to find a schedule such that its average completion time is minimum. Prove the correctness of your algorithm.

5. Optimal Binary Tree

Optimal Binary Tree는 Dynamic Programming 기법으로 풀리는 유명한 문제입니다. 그누스 형님 방법� �하면 O(n<sup>2</sup>)으로 풀립니다. 그러나 우리는 �보다 �근�으로 � 빠른 휴리스틱 버전� 작성해야 합니다.
다ì�Œê³¼ ê°™ì�´ input ì�´ 들어온다고 가정합시다. 여기서 맨 앞 하나ì�˜ 정수는 노드ì�˜ 수를 나타냅니다. ê·¸ 밑으로 노드ì—� 대한 ì •ë³´ê°€ ìž…ë ¥ë�©ë‹ˆë‹¤. 노드ì�˜ 처ì�Œì�€ key ê°’ì�´ê³ , ê·¸ 다ì�Œ ê°’ì�€ 확률(확률ì�€ 1ì�´ìƒ�ì�˜ 정수로 ìž„ì�˜ë¡œ ìž…ë ¥) 입니다. 하나ì�˜ 노드를 검색했ì�„때 실패하는 경우는 없다고 가정합시다. 최ì �ì�˜ í�‰ê· íƒ�색시간ì�„ 가지는 ì�´ì§„íƒ�색트리를 구현하고 다ì�Œì�„ ìœë ¥í•˜ì‹œì˜¤.
Inorder 순회를 통해 ê°� 키값ì�„ 모ë‘� ìœë ¥í•˜ê³ , ë˜�한 ê°� 키값ì�˜ íƒ�색시간ì�˜ 합계를 ìœë ¥í•˜ì‹œì˜¤.
!! 주� : 최�� 구하는 것� 아니고, 빠른 시간안� 최�� 가까운 값� 구하는 것� 목�임.
샘플 Output �서는 beta를 root 값으로 본 것임. 여러 풀�가 나올 수 있�. � 페�지� 하위 페�지� 코드와 설명� 올려주세요.
input
{{| 3
alph 3 beta 7 theta 10 |}}
output
{{| alph beta theta
33 |}}
풀�
작성� 개발시간 풀�
Leonardong 2h http://wiki.zeropage.org/trac/leonardong/browser/AlgorithmTrainning/OptimalBST.py
김�섭 엄청 AproximateBinaryTree/김�섭
문보창 �섭�형보다많� 알고리즘8주숙제/문보창

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:21
Processing time 0.0053 sec