# weekly updates: learning algos & JS backend[3/10/2022]

Weekly updates as a software engineer post bootcamp— learning that there are faster sort algorithms after understanding the basics and initial sorts in selection sort, bubble sort, and insertion sort.

*sidenote**: my code along with the JavaScript back end is on pause. I did leave a comment on the tutorial for other engineers to reply to my question. I have yet to revisit this issue fully. I did mention more about it in detail from my previous blog updates, **here**.*

Takeaways about on Bubble Sort, Insertion Sort, and Selection Sort (Steele)

• sorting is fundamental!

• Bubble Sort, Selection Sort, and Insertion Sort are all roughly equivalent

• all have the avg time complexities that are quadratic

• we can do better…but we need more complex algorithms

• these algorithms perform better on smaller data sets, like a small 20 items array otherwise these algorithms just will not scale well.

I like this reference on the time and space complexities on the basic sort algorithms from Colt Steele’s masterclass to algorithms and data structures in JavaScript. The next steps are to take a dive into Merge Sort, Quick Sort, and Radix Sort — while these examples will be challenging and less intuition on our end to write, the payout is way better and faster (Steele).

More on merge sort next week, here is a pseudo visual:

`merge([1, 10, 50], [2, 14, 99, 100])`

* two poniters perspective

let i = 0 and j = 0;

i

merge([1, 10, 50], [2, 14, 99, 100])

j

--> between 1 and 2, i = 1 is smaller so we will take i = 1 and move the i pointer over to th the right.

*** NEW ARRAY [1...]**

i

merge([1, 10, 50], [2, 14, 99, 100])

j

--> between 20 and 2, 2 is smaller so we will move j = 2 into the new array

*** NEW ARRAY [1, 2...]**

i

merge([1, 10, 50], [2, 14, 99, 100])

j

--> between 10 and 14, 10is smaller so we will move i= 10 into the new array

*** NEW ARRAY [1, 2, 10...]**

i

merge([1, 10, 50], [2, 14, 99, 100])

j

--> between 0 and 2, 2 is smaller so we will move j = 2 into the new array

*** NEW ARRAY [1, 2, 10, 14...]**

* i first away is done, now lets sort the remaining array

merge([1, 10, 50], [2, 14, 99, 100])

j

--> looking at the j pointer we have left 99 and 100. Our new array is already sorted and the first i pointer is done. Anything values larger and remaining after 50 is sorted into the new array.

*** NEW ARRAY [1, 2, 10, 14, 50...]**

merge([1, 10, 50], [2, 14, 99, 100])

j

*** NEW ARRAY [1, 2, 10, 14, 50, 99...]**

merge([1, 10, 50], [2, 14, 99, 100])

j

*** NEW ARRAY [1, 2, 10, 14, 50, 100] ***

merge([1, 10, 50], [2, 14, 99, 100]) sort between 2 pointers done.

**Thanks for reading. Happy coding.**

**RESOURCES • **“No More Deprecation Warning Options.” mongoosejs.com

• Steele, Colt. “JavaScript Algorithms and Data Structures Masterclass.” udemy.com (I purchased this course)

**•**Web Dev Simplified. “How To Build A Markdown Blog Using Node.js, Express, And MongoDB.” Youtube.com

• Web Dev Simplified. “JavaScript Async Await.” Youtube.com

• Web Dev Simplified. “JavaScript Promises in 10 Minutes.” Youtube.com