def max_value_1_highest_weight_value_ratio(weight_value_tuples, max_capacity):
	"""
	Solution: Compute the max value by finding the item with the highest
	weight to value ratio and use it as many times as possible until we need
	to find a smaller one that fits into the knapsack but still has the
	greatest weight to value ratio.
	This algorithm won't always find the right solution (see tests), but is
	much faster than the optimal solution and uses O(1) space.
	Complexity:
		Time: O(n * lg{n}) (where n=number of items) (sorting the input first)
		Space: O(1)
	"""
	# Sort tuples by the highest weight to value ratio descending
	weight_value_tuples.sort(key=lambda tup: tup[1] / tup[0], reverse=True)

	# Repeatedly add the highest weight-to-value tuple that still fits into
	# the knapsack until nothing else will fit
	total_value = 0
	for weight, value in weight_value_tuples:
		while max_capacity >= weight:
			total_value += value
			max_capacity -= weight

	return total_value