Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Wanna make a program....
Index -> General Programming
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CHUTHAN20




PostPosted: Tue Nov 29, 2005 6:08 pm   Post subject: Wanna make a program....

hey guys.... I have no idea about programming but i wanna make a program. i wanna make it like a dictonary.... like when i enter a word it shows the meaning... so which programming should i use.. and a good program that i could use to make that application.
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Tue Nov 29, 2005 6:31 pm   Post subject: (No subject)

if you know absolutely nothing about programming, then i dont think you should even try to make such a program, but from your previous posts, it seems like you've bee looking at turing and php, i'd start with turing just because its easier. go through the turing tutorials and try to understand strings, arrays, records, and file io
Tony




PostPosted: Wed Nov 30, 2005 9:45 am   Post subject: (No subject)

the first question to ask yourself - how would you locate a word and its definition from a list of 100 000 in a reasonable time?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
pavol




PostPosted: Wed Nov 30, 2005 10:44 am   Post subject: (No subject)

with visual basic you could probably do the same thing as turing but you don't have to worry about coding the user interface.
do_pete




PostPosted: Wed Nov 30, 2005 12:03 pm   Post subject: (No subject)

The code wouldn't be the biggest problem. It's the database that would be the hardest. It's not that it's hard, it's just that the English language has more than three million words in it
http://www.wordorigins.org/number.htm
Thuged_Out_G




PostPosted: Sat Dec 03, 2005 1:49 am   Post subject: (No subject)

maybe im slow ... but since when does turing have access to DB's ...to my knowledge youyou;d have to use a text file with some I/O
md




PostPosted: Sat Dec 03, 2005 3:13 am   Post subject: (No subject)

A database is simply a way of accessing and storing information. Most (of not all) databases store their data in files... so turing does indeed have access to DBs, you just need to write the DB yourself Wink
MysticVegeta




PostPosted: Thu Dec 08, 2005 4:11 pm   Post subject: (No subject)

Tony wrote:
the first question to ask yourself - how would you locate a word and its definition from a list of 100 000 in a reasonable time?


Well I would say, it wouldn't take that big a time if you do some of the following things,
1) Make 26 files, each file is responisble for 1 alphabet beginning for example: a.txt, b.txt
2) get user input,
3) open the file with the first letter of the input.

Now we have just reduced our time by 26X.
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Thu Dec 08, 2005 4:13 pm   Post subject: (No subject)

MysticVegeta wrote:
Tony wrote:
the first question to ask yourself - how would you locate a word and its definition from a list of 100 000 in a reasonable time?


Well I would say, it wouldn't take that big a time if you do some of the following things,
1) Make 26 files, each file is responisble for 1 alphabet beginning for example: a.txt, b.txt
2) get user input,
3) open the file with the first letter of the input.

Now we have just reduced our time by 26X.


Edit: 600th post, 900 bits, is this a coincidence lol ROFL
Tony




PostPosted: Thu Dec 08, 2005 5:38 pm   Post subject: (No subject)

MysticVegeta wrote:
Now we have just reduced our time by 26X.

I request a word that is not in the dictionary (misspelling). You still have to read nearly 4000 entries (on average) just to tell me you got no match.

Assuming a 280 byte definition, that's just about 1 MB per file to read and scan.

I guess it's not so bad if you're going for 1 line definitions.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
GlobeTrotter




PostPosted: Thu Dec 08, 2005 6:42 pm   Post subject: (No subject)

Why not do a binary search?
md




PostPosted: Thu Dec 08, 2005 8:48 pm   Post subject: (No subject)

The problem is that there are more then 100000 words that realisitcally would be in a dictionary. Storing them all in memory would be impossible, as would be a binary search tree (as you'd still need them in memory). The best you coudld do is some sort of hash based lookup table with pointers to the correct location in the database file.
CHUTHAN20




PostPosted: Thu Dec 08, 2005 10:02 pm   Post subject: hmmmmmmmmmmmmmm.....

but how does other dictionary works cuz... i have installed wordweb dictionary in my computer so how does that work??...
Martin




PostPosted: Thu Dec 08, 2005 11:01 pm   Post subject: (No subject)

It's like this.

Pick an integer from 1 to 100, and I can guess it in at most 7 tries if all you tell me is if my guess is too high or too low (or correct). It's called a binary search - binary, because you eliminate half of the possibilities each time.

For example, suppose you are thinking of 78.

My first guess is 50. You say that my guess is too low. So I've just eliminated 50 numbers
Quote:

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100


1 guess down, now I have 50 numbers that are possible.

I guess 75. Again, this is too low. So I eliminate 25 (half of the remaining numbers) numbers. Down to 25 possible numbers in two guesses.

Quote:

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75
76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100


Now I guess 87. This time my guess is too high.

Quote:

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75
76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100


Now I guess 81. Still too high.

Quote:

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75
76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100


78. Dead on. 4 guesses.

The pattern is like this: first, guess the middle number. Then guess the middle number of the remaining numbers, and so on.

Works with words too (since you can tell if a word is greater than another word). To illustrate how effective this technique is: imagine having 1,000,000 words. A binary search of the list would give you the answer in 20 guesses at most (since 2^20 > 1,000,000).
MysticVegeta




PostPosted: Fri Dec 09, 2005 12:11 pm   Post subject: (No subject)

what the? I edited the post.. why did it post as the new one, anyways,
How about using a faster language that could do the search within seconds and i am sure wtf would be able to post a lot of good tips on how to do that. Wink
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 27 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: