## Bubble sort, bubble bubble bubble sort

Did you all dance to that title? Because I sure did.

### Ok, so what is bubble sort?

It’s a comparison-based algorithm that compares each pair of items that are next to each other in a list and swaps them if they are in the wrong order. The name “Bubble” comes from how the larger items “bubble” to the top of the list during each iteration. It keeps going until no more swaps are needed.

## No worries...let's break it down.

Let’s say we have an array of items: [10, 5, 11, 20, 1]

First, bubble sort is going to compare 10 and 5 since they are the two elements. Since 10 < 5, we are going to swap their places. So now, our list will look like this:

[5, 10, 11, 20, 1]

See how the 5 is now before the 10 and is technically in “order”?

Now let’s go through the rest! We’ll compare 10 to 11. Since 11 > 10, there’s no need to swap.

You get the gist! You is smart.

So once we go through the rest (11 compared to 20 and 20 compared to 1), we arrive at the end of the first round:

[5, 10, 11, 1, 20]

Wait a minute, Rue. That’s not in order!

That’s right – we aren’t done! Remember what I said about how bubble sort will keep going until no more swaps are needed. 1 needs to move up. So we do another pass, and another, aaannnnddd another. This is what our list will look like after each pass:

1. [5, 10, 11, 1, 20] (the one from above)

2. [5, 10, 1, 11, 20]

3. [5, 1, 10, 11, 20]

4. [1, 5, 10, 11, 20]

Wow talk about a long walk for a short glass of water. See, bubble sort isn’t efficient when it comes to big list. Imagine running this code when you have 1000’s of items in an array. You might break the interviewer’s computer and then you have to do a shameful scurry out of the room. Then you bump into them at a Starbucks and avoid eye contact. It’s no bueno.

In proper terms, it has a worst-case and average time complexity of O(n^2).

I’ll be making a post soon about how this would look if we wrote out some code and even do some…TESTING (LE GASP!).

-Rue

## O Angular, Angular, wherefore art thou Angular?

Let’s cut to the chase. I had a coffee chat with a pretty Senior software engineer a few weeks back. And a piece of advice he gave me stuck to me like gum on a shoe in the middle of the summer.

He said that in order for me to stand out, I should make a “simple” app, like a to-do list. Pick a stack and make it. Then, pick up a new framework and make the same app using said framework.

Really?

Seriously, though. At first, cardiac arrest because, let’s be honest, even the to-do list is besting me. HELL I have “make a to-do list” on my to-do list.

It’s like inception and I lost my token so I can’t even tell what’s what anymore (watch the movie, you’ll get it.)

It’s the brutal honesty. Going through 100Devs as one of the many people in the #CatchUpCrew has been so frustrating (I’ll write about that experience in another post) and I feel like the minute I sit down to make an app, I go blank. It’s like all my body wants to do is write perfect code instead of just being a baddie and writing ANYTHING AT ALL!

So what does all this have to do with my not-so-subtle post title? You didn’t ask. I’m going to tell you anyways.

For the past year and change, I’ve worked with Javascript, MongoDB, NodeJS, and Express. So, in THEORY, I know how it all connects. Hell, I can connect it all day. But tell me how to connect Angular? BAH HA.

So like anything in my life, there’s no choice but to just DO IT. JUST DO IT.

But now, Angular /cue angels singing

### Components!

Like all noobs, I went the Udemy course route. But with a slightly different twist. I actually studied outside of the course (CRAZY, I know!).

I started with Maximilian Schwarzmuller’s course on Angular. Right off the bat, I love his teaching style. Pretty much straight forward. He went over installing Angular and how we can see our “app” on localhost.

After, we got into components. I like to think of components are little sections of code that live on their own and have their own lives. They have kids, spouses, jobs, and if something happens within their little suburb, it doesn’t affect the others! Probably a crappy metaphor but it is what it is.

Just like with learning any new code, I was a bit confused in the beginning. I tried listening and following but I couldn’t quite grasp the concept. Later on that day, I was on my phone and decided to check out the angular docs. I went straight to the components section, and after some brief reading, I frickin’ got it.

Something so simple as just active recall made it so I was able to understand the topic on a much deeper level. Not ONLY that – I even went ahead and tried to code out the answers to the questions Max would pose BEFORE he explained it on the video. All because I didn’t ONLY sit and listen.

Well, that’s about all for tonight. My Shark robot, who is lovingly named “Clean” Latifah is trying to clean the Christmas tree skirt by vacuuming it up into a costly mess. That’s my cue.

– Rue