| | |
Top word frequency counter help
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2006
Posts: 30
Reputation:
Solved Threads: 0
So I'm writing a program in C that reads in a bunch of words from an unspecified number of files and I'm to print out the top N words in the file. I'm using a hash to store them in, where each bucket is a linked list. The lists are sorted by alphabetical order, and every Node has a word and count variable (obvioiusly I only store unique words, repeats increment the count). I have the linked list, the hash, and the reading all working, but what I can't figure out, is an easy way to get the words with the highest counts out of the hash efficiently and print them out.
I keep track of the total number of unique words. Unless I make another array to the size of N, and keep checking in there every time I go through a Node in the hash to see if it's count is bigger than anyone in there, but that seems like way too much trouble.
My hash is basically
I keep track of the total number of unique words. Unless I make another array to the size of N, and keep checking in there every time I go through a Node in the hash to see if it's count is bigger than anyone in there, but that seems like way too much trouble.
My hash is basically
C Syntax (Toggle Plain Text)
Node** hash = (Node**)malloc(sizeof(Node*)*HASHSIZE);
![]() |
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP)
Other Threads in the C Forum
- Previous Thread: How to do parallel port programming with Windows XP in C ?
- Next Thread: Help with file
Views: 949 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays bash binarysearch centimeter char convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory drawing dynamic executable fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o inches infiniteloop initialization interest kilometer km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling segmentationfault send shape socketprograming spoonfeeding stack standard strchr string strings structures student suggestions system systemcall test testautomation unix user voidmain() wab win32 win32api windows.h






