Search:

Type: Posts; User: jeanermand

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    5,370

    Well it's part of the assignment: 11557

    Well it's part of the assignment:
    11557
  2. Replies
    4
    Views
    1,067

    I didn't get a chance to read it all the way...

    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...
  3. Replies
    4
    Views
    5,370

    Hashing a string

    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...
  4. Replies
    6
    Views
    26,722

    My bad, the sprintf is for the second hashing...

    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...
  5. Replies
    6
    Views
    26,722

    So something like this: #include ...

    So something like this:



    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main (void)
    {
  6. Replies
    6
    Views
    26,722

    Convert string to ASCII values

    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...
  7. Replies
    4
    Views
    2,873

    There are two trees, both of which are pointing...

    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...
  8. Replies
    11
    Views
    45,395

    If all you want to do is get rid of the last...

    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...
  9. Replies
    4
    Views
    2,873

    How could I get it to continue traversing from...

    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
  10. Replies
    4
    Views
    2,873

    Searching a Biinary Search 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...
  11. Thread: BST Insert

    by jeanermand
    Replies
    1
    Views
    2,740

    BST Insert

    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...
  12. Boy do I feel dumb... I just realized that I...

    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...
  13. Replies
    0
    Views
    2,688

    Inserting into a BST - ADT

    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...
  14. Yeah I've since edited it again. Each WORD struct...

    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:
    ...
  15. I thought of that, but then I thought that having...

    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...
  16. Formatting a String - Removing the newline character

    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...
  17. Ok I figured it out, it's working :biggrin: ...

    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;
    ...
  18. so perhaps something along the lines of: ...

    so perhaps something along the lines of:


    FILE *fp1;
    char buf[BUFSIZ];

    //open file

    while(fgets(buf, sizeof(buf), fp1) != NULL)
    //do something
  19. Checking for a Blank Line When Reading From a File

    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
  20. Replies
    15
    Views
    10,110

    I'm almost positive that this should work, I'm...

    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++)...
  21. Replies
    15
    Views
    10,110

    Or maybe something like this... void split(...

    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],...
  22. Replies
    15
    Views
    10,110

    void split( MATRIX *matrix , NODE **list_1, NODE...

    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...
  23. Replies
    15
    Views
    10,110

    Oh I see.. so maybe something like void...

    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++)
    {
  24. Replies
    15
    Views
    10,110

    I've had a few days to dabble in this and...

    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...
  25. Replies
    15
    Views
    10,110

    Thank you! I managed to eventually split the...

    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...
Results 1 to 25 of 46
Page 1 of 2 1 2