Efficient algorithms for ideal operations