Professional Documents
Culture Documents
BCSE204L
Dr.S.Vaishnavi
SCOPE
Vaishnavi.s@vit.ac.in
Optimization Problems
M=20, N=3
OBJECT1 OBJECT2 OBJECT3
PROFIT 25 24 15
WEIGHT 18 15 10
Note:If weight is same for all object in any problem then you can sort by
profit.
EXAMPLE-3
M= 15 N=5
OBJECT 1 2 3 4 5
PROFIT 2 28 25 18 9
WEIGHT 1 4 5 3 3
Huffman coding
• Huffman Coding is a technique of compressing data to reduce its size
without losing any of the details.
A B C D
50 40 5 5
EXAMPLE 2
A B C D E F
42 20 5 10 11 12
complexity
The time complexity of the algorithm:
• If using a simple sort algorithm (selection, bubble…) then the
complexity of the whole problem is O(n^2).
• If using min value then the complexity of the whole problem is
O(nlogn).
A B C D E F
45 13 12 16 9 5