Double LinkedList Deep Copy in Kotlin


  • Return a deep copy of a double LinkedList.
  • Each node also contains an additional random pointer, potentially to any node or null.

Code to start

data class Node<T>(     var data: T?,     var previous: Node<T>? = null,     var next: Node<T>? = null,     var random: Node<T>? = null  class LinkedList {     // TODO: Implement deep copy here. } ```