From fc671bedc19a0615448b2ffa395b4fbe33019be3 Mon Sep 17 00:00:00 2001 From: John Washam Date: Tue, 14 Jun 2016 19:28:25 -0700 Subject: [PATCH] Added notes about pointer-to-pointer. --- plan.txt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plan.txt b/plan.txt index 855fad9..e16f2de 100644 --- a/plan.txt +++ b/plan.txt @@ -175,7 +175,7 @@ Then test it out on a computer to make sure it's not buggy from syntax. * - Space - contiguous in memory, so proximity helps performance - space needed = (array capacity, which is >= n) * size of item, but even if 2n, still O(n) -Linked Lists +* - Linked Lists * - Description: * - https://www.coursera.org/learn/data-structures/lecture/kHhgK/singly-linked-lists * - Lynda.com: @@ -187,7 +187,11 @@ Linked Lists - not the whole video, just portions about Node struct and memory allocation. * - why you should avoid linked lists: - https://www.youtube.com/watch?v=YQs6IC-vgmo - - implement (with tail pointer): + * - Gotcha: you need pointer to pointer knowledge: + (for when you pass a pointer to a function that may change the address where that pointer points) + This page is just to get a grasp on ptr to ptr. I don't recommend this list traversal style. Readability and maintainability suffer due to cleverness. + - https://www.eskimo.com/~scs/cclass/int/sx8.html + * - implement (with tail pointer): * - size() - returns number of data elements in list * - empty() - bool returns true if empty * - front() - get value of front item @@ -199,11 +203,10 @@ Linked Lists * - value_at(index) - returns the value of the nth item * - insert(index, value) - insert value at index, so current item at that index is pointed to by next at index * - erase(index) - removes node at given index - - value_n_from_end(n) - returns the value of the node at nth position from the end of the list - - reverse() - reverses the list - - remove(value) - remove all elements with this value - - find(value) - return pointer to the node that has this value - Doubly-linked List + * - value_n_from_end(n) - returns the value of the node at nth position from the end of the list + * - reverse() - reverses the list + * - remove(value) - removes the first item in the list with this value + * - Doubly-linked List - Description: https://www.coursera.org/learn/data-structures/lecture/jpGKD/doubly-linked-lists - No need to implement Stacks