2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								id: 587d825a367417b2b2512c88
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								title: Reverse a Doubly Linked List
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								challengeType: 1
							 
						 
					
						
							
								
									
										
										
										
											2019-08-05 09:17:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								forumTopicId: 301714
							 
						 
					
						
							
								
									
										
										
										
											2021-01-13 03:31:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								dashedName: reverse-a-doubly-linked-list
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --description--
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Let's create one more method for our doubly linked list called reverse which reverses the list in place. Once the method is executed the head should point to the previous tail and the tail should point to the previous head. Now, if we traverse the list from head to tail we should meet the nodes in a reverse order compared to the original list. Trying to reverse an empty list should return null.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --hints--
  
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The DoublyLinkedList data structure should exist.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function () {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var test = false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if (typeof DoublyLinkedList !== 'undefined') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test = new DoublyLinkedList();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return typeof test == 'object';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The DoublyLinkedList should have a method called reverse.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function () {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var test = false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if (typeof DoublyLinkedList !== 'undefined') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test = new DoublyLinkedList();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if (test.reverse == undefined) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return typeof test.reverse == 'function';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Reversing an empty list should return null.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function () {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var test = false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if (typeof DoublyLinkedList !== 'undefined') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test = new DoublyLinkedList();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return test.reverse() == null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The reverse method should reverse the list.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function () {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var test = false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if (typeof DoublyLinkedList !== 'undefined') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test = new DoublyLinkedList();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(58);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(61);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(32);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(95);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(41);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.reverse();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return test.print().join('') == '4195326158';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The next and previous references should be correctly maintained when a list is reversed.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function () {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var test = false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if (typeof DoublyLinkedList !== 'undefined') {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test = new DoublyLinkedList();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(11);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(22);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(33);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(44);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.add(55);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    test.reverse();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return test.printReverse().join('') == '1122334455';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --seed--
  
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## --after-user-code--
  
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 13:04:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DoublyLinkedList.prototype = Object.assign(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  DoublyLinkedList.prototype,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    add(data) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (this.head == null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this.head = new Node(data, null);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this.tail = this.head;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var node = this.head;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var prev = null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        while (node.next != null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          prev = node;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          node = node.next;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        };
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var newNode = new Node(data, node);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        node.next = newNode;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this.tail = newNode;
							 
						 
					
						
							
								
									
										
										
										
											2018-10-20 21:02:47 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      };
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 13:04:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    print() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (this.head == null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var result = new Array();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var node = this.head;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        while (node.next != null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          result.push(node.data);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          node = node.next;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        };
							 
						 
					
						
							
								
									
										
										
										
											2018-10-20 21:02:47 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        result.push(node.data);
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 13:04:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return result;
							 
						 
					
						
							
								
									
										
										
										
											2018-10-20 21:02:47 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      };
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 13:04:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    printReverse() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (this.tail == null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var result = new Array();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var node = this.tail;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        while (node.prev != null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          result.push(node.data);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          node = node.prev;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        };
							 
						 
					
						
							
								
									
										
										
										
											2018-10-20 21:02:47 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        result.push(node.data);
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 13:04:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return result;
							 
						 
					
						
							
								
									
										
										
										
											2018-10-20 21:02:47 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      };
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 13:04:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2018-10-20 21:02:47 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 13:04:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## --seed-contents--
  
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								var Node = function(data, prev) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  this.data = data;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  this.prev = prev;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  this.next = null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								};
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								var DoublyLinkedList = function() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  this.head = null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  this.tail = null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  // Only change code below this line
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  // Only change code above this line
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								};
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --solutions--
  
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 21:01:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  var Node = function(data, prev) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    this.data = data;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    this.prev = prev;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    this.next = null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  };
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  var DoublyLinkedList = function() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    this.head = null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    this.tail = null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    this.reverse = function() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (!this.head || !this.head.next) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return this.head
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      let tail;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      let temp;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      let current = this.head;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      while(current !== null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if(!tail) tail = current;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        temp = current.prev;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        current.prev = current.next;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        current.next = temp;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        current = current.prev;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      this.head = temp.prev;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      this.tail = tail
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  };
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:37:37 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```