JavaScript Data Structures - 8 - Queue Overview

preview_player
Показать описание

📱 Follow Codevolution

Queue Overview
JavaScript Data Structures
Data Structures in JavaScript
Рекомендации по теме
Комментарии
Автор

is it just me or video (7) Stack Data Structure is missing in the playlist? Explaines what Stack is than straight to video 8 about Queues.

Invogue
Автор

proudly contributed to very nice tutorials

halleshubham
Автор

Hello @codevolution, stack implementation missing. please add it.😊

manojmanu
Автор

@codevolution, Could you please put stack implementation video (#7) as well. Thanks

TusharGuptaagra
Автор

thank you.. and cool AI text to speech btw 😊

g_pazzini
Автор

Sir video 7 is missing for Stack Implementation

legdayenjoyer
Автор

Stack Implementation

class Stack {
constructor() {
this.items = [];
this.count = 0;
}

push(element) {
this.items[this.count] = element;
console.log(`${element} added to ${this.count}`);
this.count += 1;
return this.count - 1;
}

pop() {
if (this.count === 0) return undefined;
let deleteItem = this.items[this.count - 1];
console.log(`${deleteItem} removed`);
this.count -= 1;
return deleteItem;
}

peek() {
console.log(`Top element is ${this.items[this.count - 1]}`);
return this.items[this.count - 1];
}

isEmpty() {
console.log(this.count == 0 ? 'Stack is empty' : 'Stack is not empty');
return this.count == 0;
}

size() {
console.log(`${this.count} elements in stack`);
return this.count;
}

print() {
let str = '';
for (let i = 0; i < this.count; i++) {
str += this.items[i] = ' ';
}
return str
}

clear() {
this.items = [];
thihs.count = 0;
return this.items
}
}

elrichrodrigues
welcome to shbcf.ru