Skip to content

Circular Linked List Implementation not Correct #2553

Description

@DEBADRIBASAK
  public void append(E value) {
    if (value == null) {
      // we do not want to add null elements to the list.
      throw new NullPointerException("Cannot add null element to the list");
    }
    // head.next points to the last element;
    head.next = new Node<E>(value, head);
    size++;
  }

This implementation of append function is not correct for circular list.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions