sallam-ahmed / Polynomial-Calculator

Data Structure 2015 Course Project
Apache License 2.0
0 stars 3 forks source link

Exporting history log. #41

Closed sallam-ahmed closed 8 years ago

sallam-ahmed commented 8 years ago

Is there is any suggested format for the exported file of the history log ? Like having the polynomials with the operations and result in a table row

sallam-ahmed commented 8 years ago

Like

Poly 1 Poly 2 ADD
poly1 poly2 add result
khaledkee commented 8 years ago

I was thinking about it! Exporting the trie as a table will not be easy. I think exporting it as text file where each line contains an operation is the easiest. But if we changed the special link characters very slightly, we can export it as a table, and it would be the best format.

sallam-ahmed commented 8 years ago

Explain why would it be hard, but exporting to text file would be easy, why not using the same algorithm of parsing the trie ? What is the slight change you mean, and why exactly? explain further

khaledkee commented 8 years ago

The last node in the first polynomial stores two polynomial operations in separate tries. For example, suppose X^2+1 is multiplied by and added to X^3+1, we can know what polynomials was X^2+1 multiplied by, and what polynomials was it added to, but not both. I mean if we created a table representing all operations done on two polynomials in a single record (row) we'll consume quite a lot time to check if the second polynomial was used in how many operations. The slight modification is to store all two polynomial operations with the same link in the first trie and in the second trie the last node will store link for each operation done on the polynomials. If you're asking why didn't we do that before, I don't know. This way is better and decreases the memory usage since many times you would use the same two polynomials. I didn't mean it's impossible to do with the current structure. As for the text, we can easily list each operation on a line. The hardness (or rather the time consuming) of exporting to table is to check if the two polynomials was used in more than one operation or not!