Why is this code running without vector header file?
Solution 1:
Your algorithm header itself includes the vector header (either directly or indirectly). Because of this, the code after the preprocessor looks the same as if you had included the vector header yourself.
You should not rely on this behavior though, as it depends on the standard library implementation you are using and can change at any time.