How does unix diff algorithm work

How does unix diff algorithm work whats is diff in UNIX? diff is a data comparison tool that calculates and displays the differences between two…