DEV Community

Discussion on: Bubble Sort In JavaScript

Collapse
 
emmabostian profile image
Emma Bostian ✨

This goes back to the principles of computer science, so you might want to read up on those principles if you're confused.

There are many different ways to write code, there's never just one answer.

Pointers are just that; pointers to a spot in an array. They keep track of the index we're at. I could have called them anything as they're just variables.

O(N2) refers to the run time. Because we're comparing every element with every other element, and Big-O refers to the worst-case scenario or upper-bound, the most comparison's you'll have to do is N * N.

Collapse
 
jcklpe profile image
Aslan French

Thanks. Reading up on those basics is a big part of what I've been trying to do lately, one reason why I found your article. Thanks!