What is the algorithm that adjusts the difficulty of the proof of works in a proof of work based cryptocurrency? For instance, Bitcoin has a proof of work based consensus algorithm, it's how Bitcoin chooses a node to create the next block in Bitcoin's blockchain. In this way the network is in consensus about the creation of the next block. Part of this block creation process is issuing the next proof of work to the network, and the consensus node, based off of the algorithm in question, may set a new difficulty on the proof of work. Bitcoin tries to keep this proof of work difficult enough but easy enough so that block creation times are around 10 minutes.

What is the algorithm that sets this difficulty?
The difficulty is a function of block creation speed.
The goal is to, on average, create blocks every 10 mins. 
It is recalculated every two weeks (link)
You can look up the calculation of difficulty in the open source code of Bitcoin
https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/pow.cpp#L49