+ 2
Creat dictionnary with c language .
Hello everyone i'm actually a simple beginner in programming and i have a project to hand out next month . I really don't know from where to start could anyone help me !
15 Antworten
+ 5
Not an easy beginner task in C. You can implement a mini version with an array of struct.
+ 4
Alphabetic characters are still numbers in C. The string.h function of strcmp can compare two character arrays regardless of their contents.
+ 4
Good luck. Any more questions you can ask here. I liked the idea so I coded something likely more complex than you need. Let me see your finished product and I will show you mine.
+ 3
Thank you very much sir !! Have a good day :)
+ 3
I will make sure to do so . Thanks again ^^
+ 3
I think u have a 3 solutions:
1) array of structs which contains key and value field. and u need to implement search, apply, append and other functions of dictionary
2) u must implement hash function, construct array with fix size (2^8, 2^16, etc.), where id of element is a hash of key. this is a fast method of access to value by key.
3) implement red-black-tree concept. for key type must be implement a less operator.
+ 2
Thanks alot ! One more question sir !! It actually tells us to create a function to search for the word existance using dichotomy :3 how do i use dichotomy with aphabets ?? (I mean the test)
+ 2
welcome)
+ 1
See https://twpower.github.io/160-hash-table-implementation-in-cpp-en for hash of char array realization
+ 1
Thanks alot Myasnikov Aleksey you helped me alot ^^ .
I will be sharing my work when i finish it ☺️
0
I was thinking the same as your first suggestion of solutions. Using arrays of struct . I still havennt reached the concept of trees so~ :) you helped me alot god bless all of you ^√^
0
The first solution have very long access time. classic map must have constant access time
0
Which type of keys u need? For simple types hash functions are already known.
What approximately size of dictionary must be?
0
Myasnikov Aleksey well in general the professor told us to create dictionnary using (tableaux de hachage ) which is hash arrays ! But we have to create our own string library and file library (so we can read the file the professor sent us) i started implementing some functions like search function compression function collision function a function to fill the array ... Ect
0
Sorry i'm not sure if it's called hash arrays in english 😅 i tried to translate that's what i got