CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@Ashish Bardhan • 14 Jan, 2012
Consider a Tree, whose every parent node can have N child nodes. It's easy to store in structures during the execution of program For that I've implemented Linked Lists.
But i wanted to store them in a Binary File, so that I don't need to input data again. I'm facing this problem since yesterday. Please, Help me OUT !!
@Ashish Bardhan • 14 Jan, 2012 If you want to take a look on my problem code
I could give my mail it to you. Gimme your email-id
I guess in that way you'll get the problem.
@Kaustubh Katdare • 14 Jan, 2012 Why don't you simply upload / post your problem code here?
@eternalthinker • 16 Jan, 2012 Which language are you using? Many languages have libraries which enable you to dump whole datastructures to a file and re-build the datastructure from such a dump. In my knowledge, Java and Python has it. Just search on this conceptt for your language.

This is the straightforward way. If such techniques are not inbuilt, write a function yourself to dump the datastructure into a file. Create your own notation to represent the data structure contents. Be creative and optimal in this 😀
@K!r@nS!ngu • 16 Jan, 2012
ashbeezone
Consider a Tree, whose every parent node can have N child nodes. It's easy to store in structures during the execution of program For that I've implemented Linked Lists.
But i wanted to store them in a Binary File, so that I don't need to input data again. I'm facing this problem since yesterday. Please, Help me OUT !!
Not getting what you are exactly asking for ????
Can you mail me the code @ kiran1905411@gmail.com
so that i can try to help you out if possible in JAVA.
@Ashish Bardhan • 30 Jan, 2012
eternalthinker
Which language are you using? Many languages have libraries which enable you to dump whole datastructures to a file and re-build the datastructure from such a dump. In my knowledge, Java and Python has it. Just search on this conceptt for your language.

This is the straightforward way. If such techniques are not inbuilt, write a function yourself to dump the datastructure into a file. Create your own notation to represent the data structure contents. Be creative and optimal in this 😀
Kinda Helpful suggestion.
Have you tried in C/C++ ??
I'm just a beginner in Core JAVA !!
@Ashish Bardhan • 30 Jan, 2012
K!r@nS!ngu
Not getting what you are exactly asking for ????
Can you mail me the code @ kiran1905411@gmail.com
so that i can try to help you out if possible in JAVA.
Well, I'm trying to do in C/C++. For example, consider a simple data structure for a Linked List Node.
struct list
{
int info;
struct list *link;
};

Now I need to store this linked list in a binary file.
If clear, then Try it out now.

The_Big_K
Why don't you simply upload / post your problem code here?
I think the HINT which I've mentioned above is way better useful.
@Ashish Bardhan • 30 Jan, 2012 However, I've discovered a solution of it : creating a replica data structure of linked list.

Though originally the linked list node has the following data structure,

struct list
{
int info;
struct list *link;
};

But now I'm making a replica of the linked list node which has the following data structure,

struct r_list
{
int info;
};

As an object of Class or even a Variable of Structure can be stored in a File using C/C++, I'll try to store them in the linear traversal order. So here's the technique:-

Traverse the original linked list 'list' linearly. Store its 'info' first of every node to the 'info' of its replica 'r_list' and we can write the 'r_list' into Binary .DAT file. In other words, I've stored the linked list in linear traversed order using a temporary structure 'r_list'.

Now in case, in case of reading and using the .DAT file. We can first store it to the 'r_list' and then create a new node by copying the 'info' of 'r_list' to that of 'list' and linking with the rear node on every iteration until there's nothing to read.

This is how we'll probably get our linked list 'list' properly using File Handling in C/C++. Hopefully, it works !!
@Ashish Bardhan • 30 Jan, 2012 Seems like now you've got my Point now.
1.3k views

Related Posts

@SAJAL MAURYA · Feb 2, 2015

mam, plz tell latest IES syllabus for electrical branch...also tel what it takes to crack this exam? Should we keep attempting it in the hope of cracking it?
17.3k views

@Ankita Katdare · May 20, 2013

When we say 'Grand', we aren't talking money. Because when Mr. Vineet Taneja, Samsung Mobile Country Head said that the Samsung Galaxy Grand Quattro will meet the needs of consumers...
1.5k views

@Sanyam Khurana · Sep 9, 2013

Hello, I was writing a code to find out the number 2^1000. Which is very very large, and no data type can handle this.. Actually I have to use the...
3.6k views

@Ankita Katdare · Feb 3, 2014

General Motors India seems to be all geared up for the Delhi Auto Expo in India which is going to be held between 7-11 February, 2014. Creating a buzz among...
1.6k views

@himanshu124 · Jul 10, 2010

i have been selected in two top colleges of NAGPUR. Ramdeobaba and YCCE. in ramdeobaba i m getting CS and in YCCE i m gettin Comp. Technology. YCCE is an...
3.5k views