Tuesday, January 10, 2017

GHA: W1D1

Today was my first day at Grace Hopper! Aside from the subway having crazy delays, it was amazing!! The instructors all seem so incredibly knowledgable and helpful and watching them talk about things that everyone in the room is so passionate about is probably one of the coolest things I'll be a part of. Sorry for that run-on there. Too much excitement, not enough time.

We're starting off with lessons on data structures; today, specifically we touched on queues and linked lists. A queue is like a line to buy movie tickets. The first one in the line, is the first one to leave the line, visa versa, the last one in the line is the last one out of the line. You can enqueue, add to the list, and dequeue, remove from the list, as well as report the size of the queue.

Linked Lists are a little more complicated. Nodes, each with a value and pointer connected to other nodes. We had to create methods to add and delete nodes, which makes you, in the end, appreciate and love Javascript array's and all the methods built in.

An example:
So you have the 'head' which points to the first value, and the tail which points to the last. The upside to this (as opposed to arrays) is that an array's length is fixed. BUT in order to say, see the size of the linked list, you'd have to traverse the entire list. You encounter the same problem when looking for a node in the middle: you'd start at the beginning and go through every. single. node. until you find what you're looking for. Now, I don't know much, but I know this sounds crazy. But alas, the programming challenge presented to us today was creating a linked list and being able to manipulate it: remove head/tail, add head/tail and search.

Tricks: tracing the next and previous values on modified lists
What helped me: drawing things out on paper and making sense of it that way.

No comments :

Post a Comment