Thread: Creating an english dictionary using c n data structures

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    Creating an english dictionary using c n data structures

    I am a b tech 2nd semester student. I have to prepare a mini project in data structures in c having lines of code=1500!
    I wish to make a normal english dicitionary using file handling n linked list..can anyone of you suggest me proper coding for that as i am a beginner in C and lack few general concepts..

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    66
    You can trust some data structure which is meant for the dictionaries
    like Linked list , Tries , Hashes.

    Based on your requirement you can use any of it.

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    57

    Re: Creating an english dictionary using c n data structures

    You can try Hash lookup table in C.
    In dictionary, searching should be faster. So it can be useful that.

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    2
    I want proper coding n logics to b used??!!

  5. #5
    Registered User matrixx333's Avatar
    Join Date
    Mar 2009
    Posts
    67
    First, your going to have to decide what your program is going to do.

    Add words?
    Delete words?
    List words?
    Count words?
    Compare words?
    Define words?

    Is the program going to store its list in a text file so it can reopen the list the next time the program is going to be run?

    Once you know "what" your program is going to do, the next step is going to be to start to write it. If your new to C programming, I'd suggest you start off by reading the tutorials on this site: Cprogramming.com - Programming Tutorials: C++ Made Easy and C Made Easy From there, I'd suggest reading "Practical C Programming" Amazon.com: Practical C Programming, 3rd Edition (9781565923065): Steve Oualline: Books I felt that it was a good introduction to C and it covers basic data structures like linked lists and trees. Once you begin to code your project, if you get stuck, your welcome to ask questions on the board, but most people here are going to ask to see what code you've written so far before they offer help.

  6. #6
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    The logic of hash will be as follows

    A hash table is made up of two parts: An array (it will be like a table which contains the data to be searched) and a mapping function, this is known as a hash function.

    The hash function provides a way for assigning numbers to the input data such that the data can then be stored at the array index corresponding to the assigned number.

    The hash function can be like this

    Code:
        int hash(char *str, int table_size)
        {
        	int sum;
    
        	/* Make sure a valid string passed in */
        	if (str==NULL) return -1;
    
        	/* Sum up all the characters in the string */
        	for( ; *str; str++) sum += *str;
    
        	/* Return the sum mod the table size */
        	return sum % table_size;
        }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. spell check in C using a dictionary file
    By goron350 in forum C Programming
    Replies: 10
    Last Post: 11-25-2004, 06:44 PM
  3. Data Structures Debugging
    By 0rion in forum C Programming
    Replies: 15
    Last Post: 08-28-2004, 10:36 AM
  4. C & Data Structures
    By xddxogm3 in forum C Programming
    Replies: 4
    Last Post: 04-25-2004, 05:13 PM
  5. can't insert data into my B-Tree class structure
    By daluu in forum C++ Programming
    Replies: 0
    Last Post: 12-05-2002, 06:03 PM