i added int datatypes and custom class datatypes in c to get higher performance

Your long_number operator+ can easily be improved by eliminating multiple copies of the vector in get_numero().

You don’t really need to make a copy of your vector to then ask for its size. Just provide a size() method for your class.

Similarly, instead of (a.get_numero())[i] (that, again, makes a copy of the entire vector before indexing into it), implement operator [] to directly access individual digits.

1,000 times longer that addition – it’s a lot! however, something like 100 times would be expected – just count how many steps you have in place of a simple add instruction

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top