This project is capable of generating animations for fractional knapsack problem for dynamic data.You can enter the data and click the "Start" button to see the animation
#How to use the application:
- After downloading the project go to “Fractional_Knapsack_Along_With_Sorting_Animation.html”
- A page opens in your web browser as shown below
- You have 2 fields i)Capacity of the bag ii)How many elements you want to add
- After entering the details, click on “Add” button.
- 4 elements will be created dynamically with the two entry fields for weight and value of each element.
- After entering the weights & values , select the animation speed and type of sorting algo based on which you want to sort the elements.
- Once the elements are sorted according to the weight/value ratio ,elements are copied into another list.
- Now we check if each element can fit into the bucket.If yes,we push the element into bucket.
- If the remaining capacity of the bucket is less than the element’s weight, we break the element and fit into the bucket.This element is marked in red.
- We can see the values of current value and remaining capacity of the bucket for every step.