Relative Content

Tag Archive for complexity

If I replace N objects with N pointers, is my space complexity still O(N)?

Lets say I get N objects as input, and I need to rearrange them into a different data structure. This means the space complexity of my algorithm will be O(N). But what if I replace the objects with pointers to objects? I’ll still have N pointers, but will it still be O(N) space complexity despite the fact that there is clearly going to be less memory taken?

If I replace N objects with N pointers, is my space complexity still O(N)?

Lets say I get N objects as input, and I need to rearrange them into a different data structure. This means the space complexity of my algorithm will be O(N). But what if I replace the objects with pointers to objects? I’ll still have N pointers, but will it still be O(N) space complexity despite the fact that there is clearly going to be less memory taken?

If I replace N objects with N pointers, is my space complexity still O(N)?

Lets say I get N objects as input, and I need to rearrange them into a different data structure. This means the space complexity of my algorithm will be O(N). But what if I replace the objects with pointers to objects? I’ll still have N pointers, but will it still be O(N) space complexity despite the fact that there is clearly going to be less memory taken?

If I replace N objects with N pointers, is my space complexity still O(N)?

Lets say I get N objects as input, and I need to rearrange them into a different data structure. This means the space complexity of my algorithm will be O(N). But what if I replace the objects with pointers to objects? I’ll still have N pointers, but will it still be O(N) space complexity despite the fact that there is clearly going to be less memory taken?

A fast algorithm for a simple multi-objective minimization?

I have a set of n (arbitrary) integer numbers S which I want to partition into k subsets S_i each of size n/k (you can assume that k divides n). Let A be the arithmetic mean of elements of the set S. I am looking for the fastest algorithm that fills each S_i with elements of S such that sum of the elements of each S_i is as close as possible to A. Essentially, this is a multi-objective minimization problem and I am looking for Pareto minimal solutions. The complexity of the brute-force algorithm is O(n!). I am wondering if there exists a faster algorithm.