In a nutshell
The fractional knapsack problem fills a bag with a fixed weight capacity to collect the most total value, and — unlike the 0/1 version — you may take any fraction of an item. That makes a simple greedy rule optimal: rank items by value-per-weight (their density), take the densest items whole until the bag is nearly full, then take just enough of a fraction of the next one to reach the capacity exactly. The only real work is the sort, so it runs in O(n log n).