Stacks and Queues — BaseCS Video Series

"Stack level too deep!"

Stacks and queues are all around us. In this video we break down what they are, how they work, and their place in every day software development.

For more on Stacks and queues, check out this post:

If you have questions or comments, please feel free to share below.

SparkPost Logo

This video series is sponsored by SparkPost. There's never been a better way for developers to send email.

Did you find this post useful? Show some love!

Really great videos! Even though I'm well familiar with these concepts, it was a good reminder, and I have half a page of notes for expanding and improving my company's high-efficiency implementations.

Wonderful episode. Welcome back Vaidehi!

Ben Halpern DEV.TO FOUNDER

Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

Loving this series! I'm a visual learner so this style is just perfect for me!

Great video, really appreciated the illustrations 👌🏾

I took CS in university, but I'm really enjoying this series. It's so well done. I love your drawings. They really help the concepts sink in for viewers. Looking forward to the next one. Keep up the great work Vaidehi!

Thanks 🙏 vaidehi joshi ...really appreciating for helping to learn and giving confident on understanding i can do it👩🏻‍🎓☺️

Hey, when you say an Array is a static Data Structure, I understand, coz in Java an array is created with an initial size. But in javaScript, arrays are dynamic. So can't see implement a stack using arrays in JavaScript.

You can easily do it with arrays. A small example:

class Stack {
    constructor() {
        this.stack = [];
    }
    push(element) {
        this.stack.push(element);
    }
    top() {
        return this.stack[this.stack.length - 1];
    }

    pop() {
        return this.stack.pop();
    }

    toArray() {
        return Array.from(this.stack);
    }

    isEmpty() {
        return this.stack.length === 0;
    }
}

You could tune it a bit to check for a maximum size or stuff like that :)

Thanks. But in this way, the stack can never get filled up, coz the array ain't static. I think different languages, have their different implementation of abstract structures. In java, you can't implement a stack with an array coz its fixed

You can always "fix" the array if you want by adding a size to the constructor. Then you check if the size is met whenever you push a new value to the stack. So yeah, the language can give you other constructs and other ways to do something, but it's totally possible to do it in JavaScript

Classic DEV Post from Apr 26

Can you explain to me what's going on in this code?

In trying to understand a Google snippet I had the thought that it might be an ...

READ POST
Follow @ben to see more of their posts in your feed.
Vaidehi Joshi
Writing words, writing code. Sometimes doing both at once.
More from @vaidehijoshi
Hash Tables — BaseCS Video Series
#computerscience #basecs
Graph Theory — BaseCS Video Series
#computerscience #basecs
Trending on dev.to
Back to basics: Naming
#naming #javascript #programming #discuss
Which contentious opinions in programming actually matter?
#discuss #webdev #programming #grannyrulescomments
Ever feel like you have "Programming Synesthesia"?
#discuss #programming #productivity
How do you get a decent estimate on the time it will take to complete a task?
#discuss #work
What are the first differences you noticed in GitHub after Microsoft bought it? Post here yours!
#github #microsoft #discuss
Dynamic Programming vs Divide-and-Conquer
#javascript #algorithms #webdev #computerscience
Follow Friday!
#discuss
When is code "too clever" / how do you think about readability/cognitive load?
#discuss