Hi,
U can use an array of Charachter pointers. This array size will be 26 as there are 26 alphabets in english language.
Then u design 26 linked lists. Each element of the array will have pointer to the head of a linked list. Each linked list will have words starting with same characher.i.e. first linked list will have all characters starting with 'a', second linked list will have all characters starting with 'b' and so on ... and last linked list will have all characters starting with 'z'.
If one has to search a word starting from 'b' then the second elelment of array wiil give pointer to the head of linked list having words starting with 'b'.
Ur system should be of the form:
*array[1]=| | | | | | | | | | | | | | | | | |<--Linked list
*array[2]=| | | | | | | | | | | | | | | | | |
*array[3]=| | | | | | | | | | | | | | | | | |
*array[4]=|| | | | | | | | | | | | | | | | |
*array[5]= | | | | | | | | | | | | | | | | |
..............................................................
..............................................................
*array[26]=| | | | | | | | | | | | | | | | |
2007-09-13 18:26:29
·
answer #1
·
answered by iqbal 4
·
0⤊
0⤋
You want a Map, which maintains pairs. Your key would be the word and the value would be the definition of the word.
A good example of this are the Map classes in Java. Any good map implementation should do very fast lookup. In the Java HashMap implementation, hashcode of the key is used to do the lookup in O(1) operations.
Good luck!
2007-09-14 02:51:34
·
answer #2
·
answered by Rob C 3
·
0⤊
0⤋
array ability it s various of records aspects with comparable datatypes, and checklist ability dynamic number of datas....u can enforce the checklist utilising arrays.it is right here ur checklist length would be fixed,say 30,so u could have basically 30 aspects on your checklist yet interior the checklist with out imposing array u can upload as many aspects u want interior the records
2016-12-13 08:39:26
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋