Hashmap in a recursive function

Can we pass hashmap to a recursive funcition, If yes what could be the disadvantages

Pass by reference or value?

1 Like

why would that matter

Pass by reference passes the address, takes O(1) time.
Pass by value creates a new copy. It will copy all keys and values of the hashmap into a new one. This is much slower.

2 Likes

Why not give it a try instead of asking it :slightly_smiling_face:?

3 Likes

This post was flagged by the community and is temporarily hidden.