Standardize indent size in Data Structures challenge seeds (#38803)
* Standardize indent size in "Priority Queue" seed * Standardize indent size in "Circular Queue" seed * Standardize indent size * Standardize indents "Search within a Linked List" * Standardize indents "Remove Elements from a Linked List by Index"
This commit is contained in:
@ -80,34 +80,34 @@ tests:
|
||||
|
||||
```js
|
||||
class CircularQueue {
|
||||
constructor(size) {
|
||||
constructor(size) {
|
||||
|
||||
this.queue = [];
|
||||
this.read = 0;
|
||||
this.write = 0;
|
||||
this.max = size - 1;
|
||||
this.queue = [];
|
||||
this.read = 0;
|
||||
this.write = 0;
|
||||
this.max = size - 1;
|
||||
|
||||
while (size > 0) {
|
||||
this.queue.push(null);
|
||||
size--;
|
||||
}
|
||||
}
|
||||
while (size > 0) {
|
||||
this.queue.push(null);
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
print() {
|
||||
return this.queue;
|
||||
}
|
||||
print() {
|
||||
return this.queue;
|
||||
}
|
||||
|
||||
enqueue(item) {
|
||||
enqueue(item) {
|
||||
// Only change code below this line
|
||||
|
||||
// Only change code above this line
|
||||
}
|
||||
}
|
||||
|
||||
dequeue() {
|
||||
dequeue() {
|
||||
// Only change code below this line
|
||||
|
||||
// Only change code above this line
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -52,13 +52,13 @@ tests:
|
||||
|
||||
```js
|
||||
function PriorityQueue () {
|
||||
this.collection = [];
|
||||
this.printCollection = function() {
|
||||
console.log(this.collection);
|
||||
};
|
||||
// Only change code below this line
|
||||
this.collection = [];
|
||||
this.printCollection = function() {
|
||||
console.log(this.collection);
|
||||
};
|
||||
// Only change code below this line
|
||||
|
||||
// Only change code above this line
|
||||
// Only change code above this line
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -69,15 +69,15 @@ function LinkedList() {
|
||||
this.add = function(element){
|
||||
var node = new Node(element);
|
||||
if(head === null){
|
||||
head = node;
|
||||
head = node;
|
||||
} else {
|
||||
var currentNode = head;
|
||||
var currentNode = head;
|
||||
|
||||
while(currentNode.next){
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
while(currentNode.next){
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
|
||||
currentNode.next = node;
|
||||
currentNode.next = node;
|
||||
}
|
||||
|
||||
length++;
|
||||
|
@ -67,13 +67,13 @@ function LinkedList() {
|
||||
if(head === null){
|
||||
head = node;
|
||||
} else {
|
||||
var currentNode = head;
|
||||
var currentNode = head;
|
||||
|
||||
while(currentNode.next){
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
while(currentNode.next){
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
|
||||
currentNode.next = node;
|
||||
currentNode.next = node;
|
||||
}
|
||||
|
||||
length++;
|
||||
|
@ -74,13 +74,13 @@ function LinkedList() {
|
||||
if(head === null){
|
||||
head = node;
|
||||
} else {
|
||||
var currentNode = head;
|
||||
var currentNode = head;
|
||||
|
||||
while(currentNode.next){
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
while(currentNode.next){
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
|
||||
currentNode.next = node;
|
||||
currentNode.next = node;
|
||||
}
|
||||
|
||||
length++;
|
||||
@ -90,14 +90,14 @@ function LinkedList() {
|
||||
var currentNode = head;
|
||||
var previousNode;
|
||||
if(currentNode.element === element){
|
||||
head = currentNode.next;
|
||||
head = currentNode.next;
|
||||
} else {
|
||||
while(currentNode.element !== element) {
|
||||
previousNode = currentNode;
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
while(currentNode.element !== element) {
|
||||
previousNode = currentNode;
|
||||
currentNode = currentNode.next;
|
||||
}
|
||||
|
||||
previousNode.next = currentNode.next;
|
||||
previousNode.next = currentNode.next;
|
||||
}
|
||||
|
||||
length --;
|
||||
|
Reference in New Issue
Block a user