Do you give attribution to all the books, articles, etc. you've read?
Everything is a derivative work.
No but for a while we were required to pay amazon when we implemented a way to save payment details on a website.
You mean there are no new ideas? I think that's a big claim. As a for instance, how is mergesort "derivative work" of bubblesort?
Actually you might need to depending on how similar your implementation is.
Copyright law here is quite nuanced.
See the Google vs Oracle case about Java.