?
Solved

how to create a list in a list

Posted on 2003-02-27
5
Medium Priority
?
251 Views
Last Modified: 2010-04-17
i want to create a list and in the list contain another list ;


 list1 -> list2 -> listN
  |         |        |  
  v         v        v
data1      data1    data1
  |         |        |  
  v         v        v
data2     data2     data2
  |         |        |
  v         v        v
dataN      dataN    dataN

im thinking of creating a struct in a struct

struct list_data{
       int data;
       char name;
       list_data *nextptr;
       list_data *preptr;
};


struct list1{
       list_data data;  
       list1 *nextptr;
       list1 *preptr;
};


what im trying to do is sort (for example a person name)
and storing everyone with the same name under one key(name)

  john     ->    alice  
   |               |  
   v               v
  -----          -----
  john x         alice abc
  10             40
  -----          ------
   |               |
   v               v
  -----          -----
  john y          alice adf
  32              20
  -----          -----

can u guys give me some idea..

0
Comment
Question by:jonathanx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 8

Accepted Solution

by:
akshayxx earned 200 total points
ID: 8032308
struct list_data{
      int data;
      char name;
      struct list_data *nextptr;
      struct list_data *preptr;
};

only this is enough .  for the rest show ur attempt at the code .
0
 
LVL 8

Expert Comment

by:akshayxx
ID: 8032315
john x         alice abc
 10             40

whats the number associated ?? .. depending on this u might need to modify the struct
0
 

Expert Comment

by:CleanupPing
ID: 9447470
jonathanx:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 8

Expert Comment

by:akshayxx
ID: 9448583
as for the struct type definition required to proceed for "list in a list" , my answer was sufficient.
for further help, the asker didnt come back.
either award to akshayxx OR delete.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question