About link list


 
Thread Tools Search this Thread
Top Forums Programming About link list
# 1  
Old 10-05-2002
Data About link list

I should use a pointer or a struct as the head of a linklist. I want use the linklist as the data structure for graph.
Such as

struct node {
int vertex;
struct node * next;
};
typedef struct node NT;

struct list{
int row;
NT * neighbour;
struct list * next;
}
typedef struct list LT;

which one is better:

LT linklist;

or

LT * linklist;

Thanks

Last edited by xli3; 10-05-2002 at 02:30 AM..
# 2  
Old 10-05-2002
LT *linklist is the way to go.

What makes linked lists cool is that you can easily modify the list. Suppose you want to drop the first entry. With the pointer you can just update the pointer and free the first entry. Inserting a new entry at the top is just as easy. But if you are maintaining a specific top entry, you must update the entry to change the top of the list.

Even if you certain that you will never want to change to top of this linked list, at others times you will want to be able to do this. You should use one method to handle all linked lists to minimize confusion.
# 3  
Old 10-05-2002
This is really helpful.Thanks a lot!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

/var/adm/messages (insterface turned off/restored) and link up & link down message.

Hi All I am facing an issue with our new solaris machine. in /var/adm/messages Apr 22 16:43:05 Prod-App1 in.routed: interface net0 to 172.16.101.1 turned off Apr 22 16:43:33 Prod-App1 mac: NOTICE: nxge0 link up, 1000 Mbps, full duplex Apr 22 16:43:34 Prod-App1 mac: NOTICE: nxge0 link... (2 Replies)
Discussion started by: javeedkaleem
2 Replies

2. Solaris

/var/adm/messages (interface turned off/restored) and link up & link down message.

Hi All I am facing an issue with our new solaris machine. in /var/adm/messages root@Prod-App1:/var/tmp# root@Prod-App1:/var/tmp# root@Prod-App1:/var/tmp# cat /var/adm//messages Apr 20 03:10:01 Prod-App1 syslogd: line 25: WARNING: loghost could not be resolved Apr 20 08:24:18 Prod-App1... (0 Replies)
Discussion started by: javeedkaleem
0 Replies

3. How to Post in the The UNIX and Linux Forums

How to list all symbolic link?

how to list all symbolic link, can i use find / path -type l (2 Replies)
Discussion started by: avtalan
2 Replies

4. Shell Programming and Scripting

How to list all symbolic link?

how to list all symbolic link can i use find / path -type l (1 Reply)
Discussion started by: avtalan
1 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Symbolic link not allowed or link target not accessible

Hi everybody, I read about treads realted to this issue but they did not resovle issue given below. Please help me resolve issue given below I have html file under /srv/www/htdocs/actual_folder ls actual_folder/ test.html and following link works... (0 Replies)
Discussion started by: newbielgn
0 Replies

6. Programming

g++ fails to link to static library when compilation and link in single command

Hello All, I've encountered a strange behaviour from g++ that doesn't make sense to me. Maybe you can shed some light on it: I have a bunch of source files and want to compile them and link them with a static library liba.a located in /usr/local/lib64 into an executable Approach 1 works... (0 Replies)
Discussion started by: magelord
0 Replies

7. UNIX for Dummies Questions & Answers

Difference between hard link and soft link

Hi Experts, Please help me out to find out difference between a hard link and a soft link. I am new in unix plz help me with some example commands ( for creating such links). Regards S.Kamakshi :) (2 Replies)
Discussion started by: kamakshi s
2 Replies

8. UNIX for Dummies Questions & Answers

need some info about symbolic link and hard link

hello folks how y'all doin well i have some questions about symbolic link and hard link hope some one answer me i open terminal and join as root and i wrote ln -s blah blah then i wrote ls i see red file called blah blah but didn't understand what is this can some one explain and... (2 Replies)
Discussion started by: detective linux
2 Replies

9. UNIX for Dummies Questions & Answers

Difference between hard link and soft link in unix

Hi All, Can any one please explain me what is the difference between hard link and soft link in UNIX. Thanks in advance Raja Chokalingam. (2 Replies)
Discussion started by: RAJACHOKALINGAM
2 Replies

10. Shell Programming and Scripting

list link

hi all i want to list an archive with his link only i use ls -l and appear a list whit all information about file. how can i quit all less name and link? :confused: (1 Reply)
Discussion started by: micromicrin
1 Replies
Login or Register to Ask a Question