473,467 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Regarding a query related to References

I am implementing a binary search tree. But, Here some of the nodes i
need to maintain a backup of .

This backup i am maintaining a Linked Lists.

Example: By using 1 to 100 numkbers i need to construct a binary
search tree.
In this some numbers
1 4 5 7 8 50 (random numbers) to be in one linked
list
2 3 8 9 (random numbers other than linked
list1) to be in second linked list.

At this time , How to i implement the same? How to i give the node
reference to both linked list and binary serach tree?

If you know can you please help me.

Jul 25 '06 #1
6 1311
On 24 Jul 2006 19:56:54 -0700, sk*******@yahoo.co.in wrote:
I am implementing a binary search tree. But, Here some of the nodes i
need to maintain a backup of .

This backup i am maintaining a Linked Lists.

Example: By using 1 to 100 numkbers i need to construct a binary
search tree.
In this some numbers
1 4 5 7 8 50 (random numbers) to be in one linked
list
2 3 8 9 (random numbers other than linked
list1) to be in second linked list.

At this time , How to i implement the same? How to i give the node
reference to both linked list and binary serach tree?

If you know can you please help me.

typedef struct _Node {
struct _Node *list_back, *list_for;
struct _Node *tree_left, *tree_right;
} Node;
?

Jul 25 '06 #2
BubbaGump writes:
[...]
typedef struct _Node {
struct _Node *list_back, *list_for;
struct _Node *tree_left, *tree_right;
} Node;
Identifiers starting with an underscore and an uppercase letter are
reserved to the implementation. It's best to avoid declaring any
identifiers starting with an underscore.

If you insist on creating a second name for something that already has
one, there's no need to use two different identifiers:

typedef struct Node {
struct Node *list_back, *list_for;
struct Node *tree_left, *tree_right;
} Node;

Or you can just drop the typedef altogether:

struct Node {
struct Node *list_back, *list_for;
struct Node *tree_left, *tree_right;
};

and refer to the type as "struct Node".

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 25 '06 #3
Can you please explain biefly.

At the time of constructing a binary search tree, shall i take the
references of particular nodes to Linked list1 or to Linked List2.
BubbaGump wrote:
On 24 Jul 2006 19:56:54 -0700, sk*******@yahoo.co.in wrote:
I am implementing a binary search tree. But, Here some of the nodes i
need to maintain a backup of .

This backup i am maintaining a Linked Lists.

Example: By using 1 to 100 numkbers i need to construct a binary
search tree.
In this some numbers
1 4 5 7 8 50 (random numbers) to be in one linked
list
2 3 8 9 (random numbers other than linked
list1) to be in second linked list.

At this time , How to i implement the same? How to i give the node
reference to both linked list and binary serach tree?

If you know can you please help me.


typedef struct _Node {
struct _Node *list_back, *list_for;
struct _Node *tree_left, *tree_right;
} Node;
?
Jul 25 '06 #4
On Tue, 25 Jul 2006 07:59:42 GMT, Keith Thompson <ks***@mib.org>
wrote:
>BubbaGump writes:
[...]
>typedef struct _Node {
struct _Node *list_back, *list_for;
struct _Node *tree_left, *tree_right;
} Node;

Identifiers starting with an underscore and an uppercase letter are
reserved to the implementation. It's best to avoid declaring any
identifiers starting with an underscore.
Really? Damn. You people really know the language details. You know
how many structs I've seen declared like this in both Windows and
Linux.

>If you insist on creating a second name for something that already has
one, there's no need to use two different identifiers:

typedef struct Node {
struct Node *list_back, *list_for;
struct Node *tree_left, *tree_right;
} Node;
The leading underscore is a common convention. Geez. I need to get
out of this f***ing group.

Jul 26 '06 #5
BubbaGump writes:
On Tue, 25 Jul 2006 07:59:42 GMT, Keith Thompson <ks***@mib.org>
wrote:
>>BubbaGump writes:
[...]
>>typedef struct _Node {
struct _Node *list_back, *list_for;
struct _Node *tree_left, *tree_right;
} Node;

Identifiers starting with an underscore and an uppercase letter are
reserved to the implementation. It's best to avoid declaring any
identifiers starting with an underscore.

Really? Damn. You people really know the language details. You know
how many structs I've seen declared like this in both Windows and
Linux.
Yes really. You're very likely to get away with it most of the time,
but the next version of your implementation is free to define a macro
"_Node" in a standard header, breaking your code.
>>If you insist on creating a second name for something that already has
one, there's no need to use two different identifiers:

typedef struct Node {
struct Node *list_back, *list_for;
struct Node *tree_left, *tree_right;
} Node;

The leading underscore is a common convention. Geez. I need to get
out of this f***ing group.
Not sure what you mean by that.

If you say the leading underscore is a common convention, you may be
right -- but it's a *bad* common convention.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 26 '06 #6
BubbaGump writes:
On Tue, 25 Jul 2006 07:59:42 GMT, Keith Thompson <ks***@mib.org>
wrote:
>>BubbaGump writes:
[...]
>>typedef struct _Node {
struct _Node *list_back, *list_for;
struct _Node *tree_left, *tree_right;
} Node;

Identifiers starting with an underscore and an uppercase letter are
reserved to the implementation. It's best to avoid declaring any
identifiers starting with an underscore.

Really? Damn. You people really know the language details. You know
how many structs I've seen declared like this in both Windows and
Linux.
I've seen identifiers _Likethis declared like this in system
header files, but that's because system header files *need* to
use identifiers in the reserved namespace for many purposes.

I'm a little baffled about what's considered part of the
"implementation" under Windows. Perhaps they use those
identifiers where they believe they're writing part of the
implementation.
--
Go not to Usenet for counsel, for they will say both no and yes.
Jul 26 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Xenophobe | last post by:
I know this isn't a MySQL forum, but my question is related to a PHP project. I have two tables. table1 table2 "table1" contains 2 columns, ID and FirstName:
2
by: Uri Lazar | last post by:
hi, im working on this for a long time. i'm using MSsql-server2000 i have a table that records users visits to rooms. the columns are room_id, user_id, visits. i want to write a query that can...
10
by: Thomas R. Hummel | last post by:
I have a stored procedure that suddenly started performing horribly. The query plan didn't look right to me, so I copy/pasted the code and ran it (it's a single SELECT statement). That ran pretty...
14
by:  | last post by:
having a spot of trouble writing this one. if you are so inclined and have a moment, i'd really appreciate your insight. i have what amounts to a purchase order type of setup...a descriptive...
10
by: Florian G. Pflug | last post by:
Hi I installed a postgres-application (which was developed on debian woody) on red hat 9 today, using the postgres 7.3 rpms from redhad. One of my the triggers uses the pg_settings table (more...
5
by: deko | last post by:
After developing an MDB in Access 2003 on WS03, then making it into an MDE and deploying it on a WinXP box with Access 2003 installed, I get this error: Function is not available in expressions...
3
by: Pravesh | last post by:
Hello All, I had some query regarding virtual functions/destructors. If a class is having some/all of its methods that are virtual then is it recommended that it should also have virtual...
5
by: Sam | last post by:
Hi, I have one table like : MyTable {field1, field2, startdate, enddate} I want to have the count of field1 between startdate and enddate, and the count of field2 where field2 = 1 between...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.