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.
8.7k views

Related Posts

@Kaustubh Katdare · Apr 15, 2012

While placing order on Flipkart, I noticed that Flipkart no longer uses CCAveneue - one of the most preferred payment gateways in India (it allows transactions in Indian Rupees). However,...
4.7k views

@Ankita Katdare · Sep 5, 2013

India Kawasaki Motors (IKM), the subsidiary of the Japanese company, is here to create much fanfare with the launch of two brand new bikes in India. With the set up...
10k views

@Ankita Katdare · Jan 14, 2015

If you have been waiting around for a phone that has the most impressive specs in the bunch, here's a phone worth mentioning from CES 2015. Called Saygus V², the...
15.2k views

@Kumari Puja · Oct 3, 2018

I m not getting my offer letter from accenture  and it has been 3 months since I uploaded all my documents for verification. I have sent multiple emails to company...
10.5k views

@Radhika Deshpande · Apr 4, 2016

Hailing from a small town in a middle class household, Surya Sankar has been a day dreamer. With a dad who is a banker and mom, a housewife, Surya grew...
5.8k views