Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how to create a list in a list

Posted on 2003-02-27
5
Medium Priority
?
259 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
  • 3
4 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

578 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