Well it's part of the assignment:
11557
Type: Posts; User: jeanermand
Well it's part of the assignment:
11557
I didn't get a chance to read it all the way through, but from what I see, there is no reason that you should be recreating your RECORD struct since they are all the same.
Declaring a typedef is...
I need to write a hash function where I take the ascii values of every letter in a string and write them to a string, after which, I take said string and divide it into sub-sections consisting of 3...
My bad, the sprintf is for the second hashing function where we have to write the ASCII values to a string.
To complete this though:
#include <stdio.h>
#include <stdlib.h>
#include...
So something like this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void)
{
So I have a hashing function whereby I have to take a string as my key, get the sum of it's ASCII values and modulo by a given size.
I realize this is relatively simple and can be accomplished...
There are two trees, both of which are pointing to the same data.
The key of the tree in question already is the frequency.
I ended up solving it by using a breadth first traversal function I came...
If all you want to do is get rid of the last character in the string, you don't need to have anything in a loop.
Since this string is statically allocated, there is no guarantee that it will be...
How could I get it to continue traversing from the point where it left off? the parameter only supports a tree header structure, not a node from the tree
So I have a Binary search tree where each node holds a struct called WORD which contains three fields: a dynamically allocated string (word), an int indicating the number of times the word is found...
So I've managed to properly handle and prepare all the data I want to store (in this case words from a text file) in an ADT style binary search tree and insert without any memory leaks.
My problem...
Boy do I feel dumb... I just realized that I could simplify my code significantly by using fscanf:
void getData (BST_TREE *wordBST)
{
FILE *fp1;
char buf[BUFSIZ], *pBuf;
int...
I am trying to build a BST ADT style containing data pointers to a WORD struct that I'm using for this application.
I've been going at this for a bit and I have yet to understand what I am doing...
Yeah I've since edited it again. Each WORD struct pointer is supposed to be placed in a BST, this was simply for the purpose of properly handing the strings before placing them in the WORD struct:
...
I thought of that, but then I thought that having the newline character would simplify the condition when looking for the end of a word.
Anyway, I found my problem. Turns out those few extra spaces...
So I'm reading in words from a text file. I start off by reading each line into a buffer string and then set a for loop to look for a space character or the newline character (as such would indicate...
Ok I figured it out, it's working :biggrin:
Well, the first part that is.
This is just a test but everything works fine and there's no memory leak
void getData ()
{
FILE *fp1;
...
so perhaps something along the lines of:
FILE *fp1;
char buf[BUFSIZ];
//open file
while(fgets(buf, sizeof(buf), fp1) != NULL)
//do something
So I have this text file which contains data about airports in the following format:
BUR Burbank
FAT Fresno
LGB Long Beach
LAX Los Angeles
MRY Monterey Peninsula
OAK Oakland
SMF Sacramento
I'm almost positive that this should work, I'm just having some difficulty adding the nodes to the new lists..
I'm calling the split function in main in a loop
for(r = 0; r < matrix->rows; r++)...
Or maybe something like this...
void split( MATRIX *matrix , NODE **list_1, NODE **list_2)
{
int r;
for(r = 0; r < matrix->rows; r++)
{
AddToList(matrix->m[r],...
void split( MATRIX *matrix , NODE **list_1, NODE **list_2)
{
int r, count;
count = 0;
for(r = 0; r < matrix->rows; r++)
{
if(count >= r)
add to...
Oh I see.. so maybe something like
void split( MATRIX *matrix , NODE **list_1, NODE **list_2)
{
int r;
for(r = 0; r < matrix->rows; r++)
{
I've had a few days to dabble in this and unfortunately procrastination got the best of me. I tried combining the two bits in the same loop but all to no avail..
Can you give me some hints as to...
Thank you!
I managed to eventually split the bottom half...
the only catch being that if I do so, the top half won't split properly.
I know I have to use new header nodes, but I figured I...