# What is the worst case runtime for this approximation algorithm

I am working with the below algorithm, what would the worst case runtime for this be?

function BPP-O-Approximate(n,c,W)
Initialize L as a list of n numbers.
Initialize B as the list [c].
k <- 1
for i from 1 to n do
x <- k + 1
for j from 1 to k do
if x = k + 1 and w_i ≤ b_k then
x <- k
end if
end for
if x = k + 1 then
b_k+1 <- c; k <- k+1
end if
l_i <- x; b_x <- b_x - w_i
end for
return L
end function


I considered the case where all the objects have the same weight of c/2. In this case, each object can only fit in a bin on its own, so the algorithm will use n bins. Since there are n objects, the algorithm will perform n iterations of the loop, and in each iteration, it may need to search through all the bins to find one with enough space. In the worst case, each object will be placed in a new bin, and each bin will contain only one object, so the algorithm will perform n^2 operations.

To this logic, I think the worst case run time is O(n^2), does this look okay so far?