* Reorganized instruction text on multiple challenges * Fixed spaces * Fixed spaces again * Update curriculum/challenges/english/08-coding-interview-prep/data-structures/add-elements-at-a-specific-index-in-a-linked-list.english.md Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * Update curriculum/challenges/english/08-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.english.md Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: added code tags
		
			
				
	
	
	
		
			4.1 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			4.1 KiB
		
	
	
	
	
	
	
	
id, title, challengeType
| id | title | challengeType | 
|---|---|---|
| 587d8250367417b2b2512c60 | Create a Queue Class | 1 | 
Description
Instructions
enqueue method that pushes an element to the tail of the queue, a dequeue method that removes and returns the front element, a front method that lets us see the front element, a size method that shows the length, and an isEmpty method to check if the queue is empty.
Tests
tests:
  - text: Your <code>Queue</code> class should have a <code>enqueue</code> method.
    testString: assert((function(){var test = new Queue();  return (typeof test.enqueue === 'function')}()), 'Your <code>Queue</code> class should have a <code>enqueue</code> method.');
  - text: Your <code>Queue</code> class should have a <code>dequeue</code> method.
    testString: assert((function(){var test = new Queue();  return (typeof test.dequeue === 'function')}()), 'Your <code>Queue</code> class should have a <code>dequeue</code> method.');
  - text: Your <code>Queue</code> class should have a <code>front</code> method.
    testString: assert((function(){var test = new Queue();  return (typeof test.front === 'function')}()), 'Your <code>Queue</code> class should have a <code>front</code> method.');
  - text: Your <code>Queue</code> class should have a <code>size</code> method.
    testString: assert((function(){var test = new Queue();  return (typeof test.size === 'function')}()), 'Your <code>Queue</code> class should have a <code>size</code> method.');
  - text: Your <code>Queue</code> class should have an <code>isEmpty</code> method.
    testString: assert((function(){var test = new Queue();  return (typeof test.isEmpty === 'function')}()), 'Your <code>Queue</code> class should have an <code>isEmpty</code> method.');
  - text: The <code>dequeue</code> method should remove and return the front element of the queue
    testString: assert((function(){var test = new Queue();  test.enqueue('Smith'); test.enqueue('John'); return (test.dequeue() === 'Smith')}()), 'The <code>dequeue</code> method should remove and return the front element of the queue');
  - text: The <code>front</code> method should return value of the front element of the queue
    testString: assert((function(){var test = new Queue();  test.enqueue('Smith'); test.enqueue('John'); return (test.front() === 'Smith')}()), 'The <code>front</code> method should return value of the front element of the queue');
  - text: The <code>size</code> method should return the length of the queue
    testString: assert((function(){var test = new Queue();  test.enqueue('Smith'); return (test.size() === 1)}()), 'The <code>size</code> method should return the length of the queue');
  - text: The <code>isEmpty</code> method should return <code>false</code> if there are elements in the queue
    testString: assert((function(){var test = new Queue();  test.enqueue('Smith'); return !(test.isEmpty())}()), 'The <code>isEmpty</code> method should return <code>false</code> if there are elements in the queue');
Challenge Seed
function Queue() {
  var collection = [];
  this.print = function() {
    console.log(collection);
  };
  // Only change code below this line
  // Only change code above this line
}
Solution
// solution required