Added notes about pointer-to-pointer.

This commit is contained in:
John Washam 2016-06-14 19:28:25 -07:00
parent 96648221cb
commit fc671bedc1
1 changed files with 10 additions and 7 deletions

View File

@ -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