A linked list of length n is given such that each node contains an additional random pointer, which…
n