How to use pointer based linked list to do adjacency list?
let say for a course structure:
Major : SubjectA -> SubjectB
core : SubjectC -> SubjectD
Elective: SubjectE
Thank You...
Linked Listuse Linked list to do ajacency list
Page 1 of 1
4 Replies - 1075 Views - Last Post: 14 April 2010 - 02:58 AM
Replies To: Linked List
#2
Re: Linked List
Posted 13 April 2010 - 08:18 AM
I'm familiar with linked lists, but I'm not entirely sure what you're asking for? Could you elaborate, please? By adjacency list, are you implying that you want to create a list of all of the links in the linked list? If so, then wouldn't that defeat the purpose of using a linked list? Or am I misunderstanding what you're asking for?
This post has been edited by callahan09: 13 April 2010 - 08:19 AM
#3
Re: Linked List
Posted 13 April 2010 - 08:49 AM
An adjacency list is a list of lists. It's just like a list, but instead of having data in the node, you have a pointer to another list. Using your example, your main list would be MajorList->CoreList->ElectiveList. You traverse this list to get a particular group of courses. Then you would traverse that resulting list to get a particular course in that group.
#4 Guest_irvine*
Re: Linked List
Posted 14 April 2010 - 02:43 AM
Thank you for your concerned.
I want to use linked list to do something like this:
MajorList -> CoreList -> ElectiveList
| | |
SubjectA SubjectC SubjectE
| |
SubjectB SubjectD
|
NULL
I want to use linked list to do something like this:
MajorList -> CoreList -> ElectiveList
| | |
SubjectA SubjectC SubjectE
| |
SubjectB SubjectD
|
NULL
#5 Guest_irvine*
Re: Linked List
Posted 14 April 2010 - 02:58 AM
Is it possible to use struct within a struct to do it?
MajorList -> SubjectA -> SubjectB
|
CoreList -> SubjectC -> SubjectD
|
ElectiveList -> SubjectE
MajorList -> SubjectA -> SubjectB
|
CoreList -> SubjectC -> SubjectD
|
ElectiveList -> SubjectE
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote








|