Advertisement

Linked lists...

Started by May 22, 2000 06:27 PM
17 comments, last by Kavos 24 years, 7 months ago
no a doubly linked list would be like this:

[NULL]<-->[ITEM]<-->[ITEM]<-->[ITEM]<-->[NULL]


in a doubly linked list there is no root node or tail node... cause the list can grow or shrink in either direction


i believe that cyclic is like this:

[ITEM]->[ITEM]->[ITEM]->-+  ^                       /  +-----------------------+


likewise with a cyclic list there is no head or tail nodes... they just get dropped in


40

www.databyss.com
www.omlettesoft.com

"Don''t meddle in the affairs of wizards, for they are subtle and quick to anger."
-40
I was under the impressing that a double linked list means that:
(a)->(b)
AND
(b)->(a)

so it is bi-dirrectional....


"Why am I the only one on the away team with a red shirt!?"

BASSOFeeSH
><>
-- What would Sweetness do?
Advertisement
Yes, linked lists just have next pointers, doubly linked lists have next and previous pointers (quite useful) and cyclic lists have the tail pointing to the head, and you can implement doubly cyclic ones, should you so wish.

In addition, I don''t know of any really good tutorials on linked lists.

-Mezz
Here''s some datastructures of the nodes as typedefs:

typedef struct SLL_NODE // SLL = Single Linked List
{
SLL_NODE *pNodeNext;
...data
}
SLL_NODE;

typedef struct DLL_NODE // DLL = Double Linked List
{
DLL_NODE *pNodePrev;
DLL_NODE *pNodeNext;
...data
}
DLL_NODE;

typedef struct BT_NODE // BT = Binary Tree
{
BT_NODE *pNodeLeft;
BT_NODE *pNodeRight;
BT_NODE *pNodeParent; // is not always needed!
...data
}
BT_NODE;
Doh!
40 Thieves: Yes, your right... damn I should know better than to answer these messages and talk on the phone and eat and drink and well you get the ideal.

(IIRC) Cyclic is a Queue.


Here is the real answer to your question:
http://ra.stsci.edu/bps/linked_list.html
http://hissa.nist.gov/dads/HTML/linklist.html
http://cslibrary.stanford.edu/103/


David "Dak Lozar" Loeser

Edited by - Dak Lozar on May 23, 2000 3:41:18 PM

Edited by - Dak Lozar on May 23, 2000 3:45:38 PM
Dave Dak Lozar Loeser
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous
Hey thanks, but giving the windows a different look? Could you explain how this would be acomlished?

Sorry I don''t know Win programming that well...

~Kavos
Advertisement
quote: Sorry I don''t know Win programming that well...


And you''re trying to make your own GUI? Ok....

Anyway, about the custom editing, I believe you can override the DrawItem function, or something like that (this is for dialog items, not sure if it holds true for windows) and draw special bitmaps etc. there.

As for the linked lists, a single linked list is like this:

[POINTER_TO_FIRST_ITEM]->[ITEM]->[ITEM]->.....->[NULL]

A doubly (hehe, neato word) linked list is like this:

[POINTER_TO_FIRST_ITEM]<->[ITEM]<->[ITEM]<->....-> [NULL]

Notice how i didn''t do a <-> on the last link, just a ->. Thats because a NULL link can''t point to the item behind because its, uh, non existant itself! In both cases, there is a head pointer that just points to the first item.
Have you programmed Win32 before?
Do you have a Win32 reference? Borland Delphi/C++ Builder do have best Win32 refs, or use MSVC Help!

Here are some idea''s and keywords that''ll hopefully help:
For your main window:
- CreateWindow(..., WS_POPUP, ...)
- case WM_PAINT: { ...; CopyBitmap2DeviceContext; ... }

For customizing buttons:
- Create with BS_OWNERDRAW
- Use WM_DRAWITEM message to draw bitmaps on your button (for example)

There are lots and lots of other methods to draw your own windows. Win32 is my favorite. I don''t know MFC but this might even be easier...?
Preference I guess... in my doubly linked lists i just the head pointer just like the rest so that it points to a NULL on both sides.

40

www.databyss.com
www.omlettesoft.com

"Don''t meddle in the affairs of wizards, for they are subtle and quick to anger."
-40

This topic is closed to new replies.

Advertisement