Skip to content

NLTN/DoublyLinkedList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DoublyLinkedList

Playing with Doubly Linked List

Basic Operations

Insertions

  • insertFront(e): Adds an element at the beginning of the list
  • insertBack(e): Adds an element at the end of the list.
  • insertAt(e): Adds an element at the specific position of the list.
  • insertBefore(e, node): Adds an element in front of the specific node.

Deletions

  • remove(key): Removes an element from the list using the key.
  • remove(Node): Removes the specific node from the list.
  • removeAt(index): Removes a node from the list at the specific position.
  • removeFirst(): Removes the first node from the list.
  • removeLast(): Removes the last node from the list.

Swapping

  • swapEnds(): Swaps the first and the last node.
  • swapNodes(node1, node2): Swaps two specific nodes.
  • swapNodes(index1, index2): Swaps nodes at the specific positions.
  • swapValues(index1, index2): Swaps the values of the nodes at the specific positions.

Printing

  • print(): Displays the complete list in a forward manner.
  • printReverse(): Displays the complete list in a backward manner.