Sobes.tech
Junior — Middle+

Basic manipulations with a singly linked list: creating nodes and operations

livecode

Task condition

Create two list elements (for example, $A and $B). Link them by establishing a singly linked connection: $A->next = $B.

Implement the simplest operations:

  • check for the presence of a link between elements;
  • insert a new element (for example, $C) between $A and $B;
  • break the link between elements.

Example code for initial node creation:

$A = new Node();
$A->next = $B;