Tutorial by Examples

Given items as (value, weight) we need to place them in a knapsack (container) of a capacity k. Note! We can break items to maximize value! Example input: values[] = [1, 4, 5, 2, 10] weights[] = [3, 2, 1, 2, 4] k = 8 Expected output: maximumValueOfItemsInK = 20; Algorithm: 1) Sort values...
Huffman code is a particular type of optimal prefix code that is commonly used for lossless data compression. It compresses data very effectively saving from 20% to 90% memory, depending on the characteristics of the data being compressed. We consider the data to be a sequence of characters. Huffman...
Given a money system, is it possible to give an amount of coins and how to find a minimal set of coins corresponding to this amount. Canonical money systems. For some money system, like the ones we use in the real life, the "intuitive" solution works perfectly. For example, if the diffe...
The Problem You have a set of things to do (activities). Each activity has a start time and a end time. You aren't allowed to perform more than one activity at a time. Your task is to find a way to perform the maximum number of activities. For example, suppose you have a selection of classes to ch...

Page 1 of 1