One Pager Cheat Sheet
- Understanding the fundamentals of data structuresand when to appropriately use alinked listis essential in software development.
- Linked lists are linear data structures, meaning elements are traversed and constructed in a sequence and order, similar to a game of hopscotch.
- A linked listis a linear data structure composed ofnodes that usepointersto reference the next element in sequence and the starting and ending point of the list is marked by theheadandtail, respectively.
- A nodein alinked listcontains two essential parts: data members storing information and a link providing apointerto the nextnode.
- A singly linked list consists of nodesthat storedataand areferencepointing to the next node.
- A doubly linked list has nodes with a data value, a reference to thepreviousnode, and a reference to thenextnode.
- A circularlinked listallows efficient traversal of a full list beginning at any node.
- A circular linked list consists of a set of nodeswhich link to one another in an unbrokencircular sequence, with the tail node pointing back to the head node.
- Linked lists are beneficial for shifting elements around, while arrays allow for faster item lookup in constanttime.
- A linked list is dynamically size-abledue to itspointersthat reference thenextmemory address, making it easier to add and remove nodes compared to an array, which must be shifted around.
- Reversing a linked listinvolves reassigning thenextproperty of each node and iterating through the list with three pointers (current,next, andprev) to achieve the desired reversal.
- The print(Node head)functionloopsthrough thelinked liststarting from theheadnode and prints out the values of eachnodeto the console.
- The Nodeclass needs to be given the pointer to thenextNodein order to link them together in a linked list.
- We use a ptrpointer to handle the special case when it isnull, and then use atailpointer to iterate over the originallinked listand create a copy.
- Deciding whether or not to use a linked listrequires consideration of both the advantages and drawbacks, and one can further their understanding by implementing one.


