k
New Member
Posts: 2
|
Post by k on Apr 9, 2002 19:27:37 GMT -5
Hmm...wondering why nobody's posting any questions for this assignments. Neway, I was just wondering if neone know how to do or even start #2, becuz it just got confusing by adding doubly linked list...?
|
|
|
Post by Yingster on Apr 10, 2002 8:07:23 GMT -5
i just started with the base case with 1 node which has 0 non-null pointers.
|
|
|
Post by Observer on Apr 10, 2002 18:38:45 GMT -5
I did it the same way as Yingster.
|
|
|
Post by CooLiBoP on Apr 10, 2002 18:42:45 GMT -5
Here's a tip: Note that when you add a node that there are 2 more non-null pointers that are created.
|
|
|
Post by Tony on Apr 10, 2002 20:02:11 GMT -5
the formula doesn't work for n = 0, so base case must be n = 1
|
|
|
Post by Majin_Blues on Apr 11, 2002 16:29:57 GMT -5
does the base case really work for n = 1? when it does, it means that there's no null pointers, but that can't be...
what if the main pointer of the single node is not a null pointer... that would make it at least one null pointer...
it would make sense if the base case was 2
|
|
|
Post by Tony on Apr 11, 2002 16:46:27 GMT -5
no, we're looking at non-null pointers, not nullls
|
|
|
Post by Majin_Blues on Apr 11, 2002 19:36:10 GMT -5
that's what i mean... given ONE node, you'll have 3 pointers in it... would you? the prev, the main and the next... or is it just a node with just a prev and a next and nothing else?
|
|
|
Post by Observer on Apr 11, 2002 20:09:54 GMT -5
With one node you'll have ZERO non-null pointers. The pointer to the next link will be null and the pointer to the previous node will be null (since there's only one node in the list). Therefore there are ZERO non-null pointers.
|
|
|
Post by Sylph on Apr 11, 2002 23:59:47 GMT -5
that's what i mean... given ONE node, you'll have 3 pointers in it... would you? the prev, the main and the next... or is it just a node with just a prev and a next and nothing else? the node just has a prev and a next; that's why it's called a doubly-linked list.
|
|