Algorithm Book - Chapter 5 - Linked Lists Flashcards
What is the shortcut on mac to open developer console on browser?
cmd - option - J
What are objects?
Objects are a collection oif attributes and functions. Because they are available in size, they are allocated int the memory heap.
Would do object constructors return?
Pointers, which are fixed in size and hence can be held in local variables
What is a pointer?
A pointer is just some particular memory location referring to a location in the heap where some object has been allocated.
Although calling console.log() on some variable containing a pointer wil display the contents of the allocated object, this is only because the browser is trying to be helpful - the actual contents of that variable (the pointer itself) is merely a nubmer representing some memory location(not what is stored at that location).
What is dereferencing?
Dereferencing a points means traveling across it, to the attributres and functions within the object on the other side. We dereference a pointer, append . plus an attribute name.
What is a linked list?
A linked list is a sequence of connected node objects. NOdes contain .next pointers, plus other attributes as needed.
Why linked lists over arrays?
Linked lists are preferable to arrays if frequently adding/removing values mid-sequence. Unlike arrays, singly linked lists directly access only the first node - to reach later ones, we traverse from one node to the next one by following the sequence of .next pointers.
SINGLY LINKED LISTS HAVE THE ABILITY TO TRAVERSE ONLY FORWARD THROUGH THE LIST, BECAUSE THEY CONTAIN ONLY A SINGLE LINK BETWEEN NODES.
What is a good best practice when coding variables?
NEVER USE SINGLE LETTER VARIABLES…always comment usefully, create a block comment before every file.