Cyclokitty / data_structures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

30 Days of Data Structures and Algorithms

Keeping track of learning ds&a.

Day 1 (Aug 12, 2021):

Working on Queues. Pretty basic add method and remove method. Spent a few minutes setting up a node project with nodemon.

Day 2 (Aug 13, 2021):

Made a Stack class. It's very similar to an array but you build more controls by implementing functions you want to use. I created pop(), push(), and peek(), and length() methods.

The algorithm assigned in the course annoyed me. I do not want to create a class that take a Stack and force Queue functionality. It's literally just stacking one Stack, restack into a second Stack, then return the last item in the first Stack as a Queue item. I get the idea, I refuse to waste time implementing busy work.

I did add a print() to both Stack and Queue classes.

Day 3 (Aug 14, 2021)

First thing: this is a new computer and I forgot to set up SSH with Github. Of course, it's been a long time since I did this on my previous computer and that meant some reading in the Github docs. A bit of copy and paste in the terminal and voila! I can upload to Github!

Back to our DS&A show...

Began learning how to build a Linked List. I've used LL in the past with Java and it was a pretty easy and efficient way to deal with data.

Build insertFirst(), size() methods.

Day 4 (Aug 14, 2021)

Do you know what is underrated?

While loops! They get to the point. Either you find or don't find an item, then you go on your merry way. Sure, it's easy to get caught in an infinite loop but if I understand what I'm looking for and what I should be limiting (to end the while loop), then all is golden.

I used the while loop in the size() and getLast() methods.

Also, built the clear() method.

Day 5 (Aug 16, 2021)

removeLast() method hurt my head as I tried visualizing the next node as a while loop traversed the LL chain.

Will try again tomorrow.

Day 6 (Aug 17, 2021)

Sorted out removeLast()! Then, worked on insertLast(data). Also, worked on a print() method because the console.log doesn't print out the chained items nicely.

Day 7 (Aug 18, 2021)

Worked on print method. Started removeAt() method but needs more work.

Day 8 (Aug 26, 2021)

... bit of a holiday ...

OK! It took some work but I figured out removeAt() method and it works. Yay.

Also, fixed up print() a bit more and so far I'm happy with it.

Day 9 (Aug 30, 2021)

Built the insertAt(data, index) method. Didn't take me too long but it is a bit janky. Strangely, I like it. It's a bit to read but I think it covers each edge case before getting to a simple insertion.

Day 10 (Sep 1, 2021)

Completed the forEach() method for the LinkedList data structure and completed the midpoint algorithm.

forEach() was pretty straight forward.

The midpoint algo required me to find the midpoint of a linkedList BUT I could not use a pointer variable or use the size() method.

About


Languages

Language:JavaScript 100.0%