![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help in Directory Structure | murtaza | Shell Programming and Scripting | 5 | 03-29-2007 11:14 AM |
| MV files from one directory structure(multiple level) to other directory structure | srmadab | UNIX for Advanced & Expert Users | 4 | 09-13-2006 04:01 PM |
| Copying a Directory Structure to a new structure | jhansrod | UNIX for Dummies Questions & Answers | 8 | 07-27-2005 06:24 AM |
| if then else structure | props | UNIX for Dummies Questions & Answers | 4 | 12-27-2003 06:50 AM |
| Ram structure | Dorian | HP-UX | 1 | 11-05-2002 09:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Search attributes in one structure using the values from another structure
Hello Groups
I am trying to find out ways of comparing a value from a 'c' structure to a value in another 'C' structure. the 'C' structure can be a List or liked list as it contains lot many records. if we loop it in both the structures it is going to consume time. I am looking for a simple algorithm where i can implement it easily. For eg) struct x { char empname[20] ; int empno; int deptno; }x1; struct y { char deptname[20]; int deptno; }y1; Structure x can be in a list where it contains say 1000 records and similaraly y. I need to search the deptno of x in deptno of y. Reply me if you have ideas. Regards Dhanamurthy |
|
||||
|
I also have another idea as to
put the two files in a List and do a binary search from the input of one of the List. Not sure if there is a performance issue in this way. Can you please let me know what is chain hashing by an example? I am not clear on how to avoid the overhead. Regards Dhanamurthy |
|
||||
|
The idea of a chained hash table is simple.
Given a key (character array) compute in a 'table' the location to which the character string hashes using a hash value derived from the key. Code:
void placenode(void **arr, void *node, char *key, int arrsz) {
int p = 0;
struct typewhatever *datum;
while (*key != '\0') {p += (31 + *key); key++;}
datum = arr[p % arrsz];
append_node(datum,node);
}
subset of identically hashed values. HTH. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|