Added notes about pointer-to-pointer.
This commit is contained in:
parent
96648221cb
commit
fc671bedc1
17
plan.txt
17
plan.txt
@ -175,7 +175,7 @@ Then test it out on a computer to make sure it's not buggy from syntax.
|
|||||||
* - Space
|
* - Space
|
||||||
- contiguous in memory, so proximity helps performance
|
- contiguous in memory, so proximity helps performance
|
||||||
- space needed = (array capacity, which is >= n) * size of item, but even if 2n, still O(n)
|
- space needed = (array capacity, which is >= n) * size of item, but even if 2n, still O(n)
|
||||||
Linked Lists
|
* - Linked Lists
|
||||||
* - Description:
|
* - Description:
|
||||||
* - https://www.coursera.org/learn/data-structures/lecture/kHhgK/singly-linked-lists
|
* - https://www.coursera.org/learn/data-structures/lecture/kHhgK/singly-linked-lists
|
||||||
* - Lynda.com:
|
* - Lynda.com:
|
||||||
@ -187,7 +187,11 @@ Linked Lists
|
|||||||
- not the whole video, just portions about Node struct and memory allocation.
|
- not the whole video, just portions about Node struct and memory allocation.
|
||||||
* - why you should avoid linked lists:
|
* - why you should avoid linked lists:
|
||||||
- https://www.youtube.com/watch?v=YQs6IC-vgmo
|
- 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
|
* - size() - returns number of data elements in list
|
||||||
* - empty() - bool returns true if empty
|
* - empty() - bool returns true if empty
|
||||||
* - front() - get value of front item
|
* - front() - get value of front item
|
||||||
@ -199,11 +203,10 @@ Linked Lists
|
|||||||
* - value_at(index) - returns the value of the nth item
|
* - 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
|
* - 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
|
* - 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
|
* - value_n_from_end(n) - returns the value of the node at nth position from the end of the list
|
||||||
- reverse() - reverses the list
|
* - reverse() - reverses the list
|
||||||
- remove(value) - remove all elements with this value
|
* - remove(value) - removes the first item in the list with this value
|
||||||
- find(value) - return pointer to the node that has this value
|
* - Doubly-linked List
|
||||||
Doubly-linked List
|
|
||||||
- Description: https://www.coursera.org/learn/data-structures/lecture/jpGKD/doubly-linked-lists
|
- Description: https://www.coursera.org/learn/data-structures/lecture/jpGKD/doubly-linked-lists
|
||||||
- No need to implement
|
- No need to implement
|
||||||
Stacks
|
Stacks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user