Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading db.db in Data Structure.

 
Pallavi Mahajan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to know,is it valid if I read db.db file in data structure ? I have read all the topics related to db.db file posted in this forum and to my perception it is not necessary...the flat file is what required. Again, having soft copy of data is faster and its easy to implement search algorithm with data structure.
I don't want my points to cut just because I'm thinking complex...can anybody clear my ideas regarding this first step in java assignment.
I'll be thankful.
Pallavi Mahajan.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I want to know,is it valid if I read db.db file in data structure ? I have read all the topics related to db.db file posted in this forum and to my perception it is not necessary...the flat file is what required. Again, having soft copy of data is faster and its easy to implement search algorithm with data structure.

If you are talking about replicating and manipulating the database in memory, then no, it's not what this assignment about. Your JTable would reflect the database, but all the operations, such as modify() should be done on the database directly.
Eugene.
 
Pallavi Mahajan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eugene,
I want to implement shortest path algorithm for flight search, for that I want to store my data in matrix. Can I do that?
Pallavi
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to implement shortest path algorithm for flight search, for that I want to store my data in matrix.
Do you mean the fastest algorithm? Your instructions say something to the effect that if increased performance is accompanied by increased complexity, you would be penalized.
Eugene.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eugene said:
If you are talking about replicating and manipulating the database in memory, then no, it's not what this assignment about.
Where does it say this, Eugene?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My instructions say:
For any design choice concerning topics not specifically described in the requirements, marks are awarded for a clear and consistent approach, rather than for any particular solution. Design decisions must be described briefly but clearly in your comments.
There is no mention of penalization (except for rolling your own when you can get it off the J2SDK API shelf)
 
Pallavi Mahajan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eugene,
Yes I mean fastest algorithm ..and it does use data structure. So what do you suggest me to do? Not to use that and use only flat file?
Pallavi
 
S. Ganapathy
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pallavi,
I really don't know what u mean fastest algorithm. Do u mean reading bytes from flat file(database from here onwards)? database is the authoritative one for data. Suppose, if other application also modifying the database concurrently, then loading the data from database into a data structure, does not carry meaning, I suppose(every time we should read the data from database is right way). Please correct me, if I am wrong.
There can be ways to read the data from the database at a faster pase. But here one thing we should really keep in mind. How long are we holding the database reference with in the method, which reads data from database. Surely we can minimise holding time of this database reference(i mean file object/input stream). Instead of reading byte by byte, if we makeout to read one full record in a single go, and release file object, then we are in a position that we are optimising resource usage, increases the performance. Please go through the database schema section in ur assignment instructions carefully, and makeout some mathematical relation to index to the record user wish to read, if u reach to that position by seek, and read that particular lenght of record in single go(like randomAccessFile.readFully(bytearray[int lengthOfRecord])), it will be meaningful.
I don't know about the details of ur assignment really, and I couldn't makeout what u really want. If it is not useful to what u r looking for, let our gurus clarify ur doubt.
Thanks
GVRao
 
Panku Panchal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi GVRao,
Please go through the database schema section in ur assignment instructions carefully, and makeout some mathematical relation to index to the record user wish to read, if u reach to that position by seek, and read that particular lenght of record in single go(like randomAccessFile.readFully(bytearray[int lengthOfRecord])), it will be meaningful.
I'm really sorry for confusing everybody....I myslef was so much confused.
What you've told is really helpful to me. Actually I was thinking of which data structure will be useful while user search in CriteriaFind. If I'm not wrong Map , hashMap are most suitable.
Please correct me if I'm wrong. Can you clarify which will be better Map or hashMap?
Thank you and sorry for confused statements.
pallavi
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry Gaunt: There is no mention of penalization (except for rolling your own when you can get it off the J2SDK API shelf)
Unfortunately I deleted my instructions (I passed some time ago), so I can't quote directly, but from what I can remember it said very explicitely that the solutions that add complexity for the sake of performance will be penalized. I took the FBN version of the exam, so I guess the instructions have changed since then.
Eugene.
 
Pallavi Mahajan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The information regarding complexity is as follows
Clarity and Maintainability.
A clear design, such as will be readily understood by junior programmers, will be preferred to a complex one, even if the complex one is a little more efficient than the simple choice. However, poor algorithm design where standard solutions are well known will be penalized.

so it says poor algorithm design will be penalized.
Thank you
Pallavi
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my NX instructions it says only:
A clear design, such as will be readily understood by junior programmers, will be preferred to a complex one, even if the complex one is a little more efficient. Code complexity, including nesting depth, argument passing, and the number of classes and interfaces, should be reasonable.

Now what happens if we make it a lot more efficient rather than a little more efficient?
[ April 25, 2003: Message edited by: Barry Gaunt ]
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Barry Gaunt:
Now what happens if we make it a lot more efficient rather than a little more efficient?

Something like rewriting the JVM and packaging it with your assignment?
Eugene.
[ April 25, 2003: Message edited by: Eugene Kononov ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eugene Kononov:

Something like rewriting the JVM and packaging it with your assignment?

Got no answer to that one, yet, but I'm sure going to think of one...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic