March 10th, 2011, 12:09 PM
Database VS Data Structure
Why do we need to learn data structure? Why don't we just use database and sql command?
I am not quite sure but I think a database has flatten files. When running a database server, it creates an object which can serve operations (e.g. find, insert, remove, sort).
Q1: Is that object like a data collection that has some kinds of data structure inside? or Is that object like a stream?
I can code a program to read data from a text file and create an object to keep the data in any kinds of data structure (e.g. binary tree, hash map). In other word, to load data from disk to memory with a data structure. But loading tends to be slow. A sql database seems to be a better idea.
Initializing is faster, and all operations is fast too. Only one thing I can think why I need to use data structure is only when I manage with small data. It may not worth to create a database. But if i operate only small data, why do I need binary tree, hash map, etc. I just use an array.
Q2: In what kinds of application do we need data structure source code instead of a database?
The question may sound trivial for someone.
But I really doubt it. Please help!!
March 10th, 2011, 02:52 PM
Re: Database VS Data Structure
Sorry, I don't understand very well your question.
1. What do you mean by "data structure source code" and "database" ?
To me, a "database" is usely a word used by an analyst, and a "data structure source code" is an expression used by a programmer. Both things are almost the same, but they are used on different levels.
2. Your main criteria seems to be the speed of loading.
In the real world, who cares if a Select takes two miliseconds or two tenth of a second ?
You are neglecting other very important issues, such as readability, time to program, compatibility with several environments, etc.
3. You are talking about a global choice, but it is better to be pragmatic.
If your program is really too slow, then start to think about various solutions to improve the speed. But unless speed is really an issue, then you'd better spend your time finding bugs and adding new functions to your application.
4. It is a good question.
It seems you are a student and you don't agree with a professor. That's a good thing, because there are many professors who are wrong. You know the old saying, that those who know, are doing things, and those who don't know are teaching others how to do things.
Last edited by olivthill2; March 10th, 2011 at 02:54 PM.
Tags for this Thread
Click Here to Expand Forum to Full Width