Skip to content

Commit 797f654

Browse files
committed
Modified Dosctrings
1 parent 5c78361 commit 797f654

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pygorithm/greedy_algorithm/activity_selection.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
Created On: 26th August 2017
44
"""
55
import inspect
6-
# TODO: Explain what this is / how it works
76

87

98
def activity_selection(start_times, finish_times):
109
"""
10+
The activity selection problem is a combinatorial optimization problem concerning the selection of
11+
non-conflicting activities to perform within a given time frame, given a set of activities each marked
12+
by a start time (si) and finish time (fi). The problem is to select the maximum number of activities
13+
that can be performed by a single person or machine, assuming that a person can only work on a single
14+
activity at a time.
15+
1116
:param start_times: An array that contains start time of all activities
1217
:param finish_times: An array that conatins finish time of all activities
1318
"""

pygorithm/greedy_algorithm/fractional_knapsack.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
Created On: 22nd August 2017
44
"""
55
import inspect
6-
# TODO: Explain how this works / Explain what a knapsack is
76

87

98
def knapsack(w, item_values, item_weights):
109
"""
10+
The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of
11+
items, each with a weight and a value, determine the number of each item to include in a collection so
12+
that the total weight is less than or equal to a given limit and the total value is as large as
13+
possible. It derives its name from the problem faced by someone who is constrained by a fixed-size
14+
knapsack and must fill it with the most valuable items.
15+
1116
:param w: maximum weight capacity
1217
:param item_values: a list of values of items in the knapsack
1318
:param item_weights: a list of weights of items in the knapsack

0 commit comments

Comments
 (0)