Click here to Skip to main content
15,914,444 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralTEMPLATE FUNCTIONS Pin
ISUstudent19-Sep-04 18:56
ISUstudent19-Sep-04 18:56 
GeneralRe: TEMPLATE FUNCTIONS Pin
Antti Keskinen19-Sep-04 23:08
Antti Keskinen19-Sep-04 23:08 
GeneralPragma Pin
caoquanghanh19-Sep-04 18:43
caoquanghanh19-Sep-04 18:43 
GeneralRe: Pragma Pin
Ramkrishna Pawar19-Sep-04 20:19
Ramkrishna Pawar19-Sep-04 20:19 
GeneralRe: Pragma Pin
caoquanghanh22-Sep-04 19:47
caoquanghanh22-Sep-04 19:47 
GeneralRe: Pragma Pin
Alpha Siera20-Sep-04 3:06
Alpha Siera20-Sep-04 3:06 
Generalcircular linked lists Pin
jhorstkamp19-Sep-04 17:42
jhorstkamp19-Sep-04 17:42 
GeneralRe: circular linked lists Pin
Antti Keskinen19-Sep-04 23:28
Antti Keskinen19-Sep-04 23:28 
The solution is to think in 3D.

First, consider that you have a circle of cells. This represents the top level linked list. Each cell contains an index number (integer) and a pointer to the next node of the circle. This linked list is called 'primary list'.

Now, enhance each of these cells so that they also contain a second pointer. Each of these cells becomes the first cell of a secondary linked list that rotates from the 2D plane up, does a circle, and returns down again. The second pointer points to the next cell of the secondary linked list.

Here is a declaration of the cell structure
struct Node {
   int nNumber;
   element_type* ptrNext;
   element_type* ptrDown;
};
The primary linked list has valid values in all entries. ptrNext points to the next cell in the primary list, and ptrDown points to the next cell in the secondary list. The secondary list has two types of cells:
a) Members of the primary and secondary lists, with valid values in all entires
b) Members of the secondary list only, with a NULL value in ptrNext

In the primary list, the nNumber entry contains an index number that identifies an individual list from the chain, e.g. list at index position 1. In order to keep it simple, you could use negative values in the primary chain, and positive values in secondary chains. This would make it easy to identify any given cell: if it's value is negative, it's the linking cell between a secondary and a primary list. If it's positive, it's an individual cell in some secondary list.

If the above was implemented, then those cells with negative values would be the headers of the secondary lists, as stated in ADT language. The primary linked list might also have a header. This header's ptrDown value should be NULL, or index value should be 0, to seperate it from the other members of the primary list and the members of the secondary lists.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralString stuff Pin
Timothy Grabrian19-Sep-04 17:02
professionalTimothy Grabrian19-Sep-04 17:02 
GeneralRe: String stuff Pin
Aamir Butt20-Sep-04 0:06
Aamir Butt20-Sep-04 0:06 
GeneralRe: String stuff Pin
David Crow20-Sep-04 6:00
David Crow20-Sep-04 6:00 
GeneralRe: String stuff Pin
Timothy Grabrian20-Sep-04 11:59
professionalTimothy Grabrian20-Sep-04 11:59 
GeneralRe: String stuff Pin
David Crow20-Sep-04 16:52
David Crow20-Sep-04 16:52 
GeneralRe: String stuff Pin
Archer28220-Sep-04 13:16
Archer28220-Sep-04 13:16 
Generalchanging text color Pin
Jump_Around19-Sep-04 15:19
Jump_Around19-Sep-04 15:19 
GeneralRe: changing text color Pin
Archer28219-Sep-04 16:09
Archer28219-Sep-04 16:09 
GeneralRe: changing text color Pin
Sujan Christo20-Sep-04 1:52
Sujan Christo20-Sep-04 1:52 
Generalmaking your app upgradable Pin
mickelliot19-Sep-04 15:05
mickelliot19-Sep-04 15:05 
GeneralRe: making your app upgradable Pin
Christian Graus19-Sep-04 15:59
protectorChristian Graus19-Sep-04 15:59 
GeneralRe: making your app upgradable Pin
mickelliot19-Sep-04 16:11
mickelliot19-Sep-04 16:11 
GeneralRe: making your app upgradable Pin
mickelliot19-Sep-04 16:13
mickelliot19-Sep-04 16:13 
GeneralRe: making your app upgradable Pin
Christian Graus19-Sep-04 16:15
protectorChristian Graus19-Sep-04 16:15 
GeneralCSocket GetSockName Pin
transfer168919-Sep-04 11:55
transfer168919-Sep-04 11:55 
GeneralCalling my COM server via VBScript Pin
Alexander M.,19-Sep-04 10:12
Alexander M.,19-Sep-04 10:12 
General[edit] Who rated this?[/edit] Re: Calling my COM server via VBScript Pin
Jörgen Sigvardsson19-Sep-04 10:15
Jörgen Sigvardsson19-Sep-04 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.