Search:

Type: Posts; User: qubit67

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    1,065

    and solution: int within_range (data_t...

    and solution:


    int within_range (data_t value, data_t low, data_t hi)
    {
    if (((cmp (value, low)) >= 0) && ((cmp (value, hi)) <= 0))
    return 1;
    else
    return 0;
    }
  2. Replies
    6
    Views
    1,065

    thats right iMalc, I want to count the nodes from...

    thats right iMalc, I want to count the nodes from the low value to the hi value in the tree, and the error is:


    Enter int values into a BST:
    0 1 2 3 4 5 6 7 8 9
    for what range would you like...
  3. Replies
    6
    Views
    1,065

    what am I doing wrong?

    I am coding a range function for a BST, can some one help me with what I'm doing wrong here?


    typedef int data_t;
    typedef struct bnode bstree_t;

    struct bnode
    {
    data_t data;
    bstree_t...
  4. Replies
    28
    Views
    3,961

    In concluding this thread, It saddens me to see...

    In concluding this thread, It saddens me to see how people can act as a hinderance to someone trying to figure out something. Instead of SIMPLE answers and support, I had an uphill battle with the...
  5. Replies
    28
    Views
    3,961

    this works too: list_t *matches (bstree_t...

    this works too:


    list_t *matches (bstree_t *index_tree, char *prefix)
    {
    int len, compare;
    bstree_t *current_node, *sub_tree;
    list_t *list;

    list = make_empty_list ();
  6. Replies
    28
    Views
    3,961

    the logic I am supposed to use

    ok, so I have found that the best approach to the matches function is to not make it recursive, but to have it call another function that is recursive, and pass it the list to insert the phrases into.
  7. Replies
    28
    Views
    3,961

    My logic is that matches searches from the root...

    My logic is that matches searches from the root of the whole tree down each level through each node using the compare function to find a value that matches. The search starts from the root and moves...
  8. Replies
    28
    Views
    3,961

    I know, I get so KraZy sometimes...

    I know, I get so KraZy sometimes...
  9. Replies
    28
    Views
    3,961

    Ok, sorry for bumping, I just hate being...

    Ok, sorry for bumping, I just hate being avoided.... ;P
  10. Replies
    28
    Views
    3,961

    trust me, i am a step ahead... oh, and again,...

    trust me, i am a step ahead...

    oh, and again, thanks for the help
  11. Replies
    28
    Views
    3,961

    you know what?

    I will bump my thread if i have to, and I have to.
    So, take your your thumb out of your a&& and give me a hand here, or leave me alone, wont make a difference... Over the last week I have grown...
  12. Replies
    28
    Views
    3,961

    hello?

    hello?
  13. Replies
    28
    Views
    3,961

    For example : Enter phrases to input to the...

    For example :


    Enter phrases to input to the tree:

    alpha
    beta
    cappa
    nequ
    neqi
  14. Replies
    28
    Views
    3,961

    I dont think I understand what you mean by...

    I dont think I understand what you mean by append. If you mean at the end, I would have to make a new list called sublist and dereference the right pointers to their coeerct positions:
    ...
  15. Replies
    28
    Views
    3,961

    I dont have a variable called sublist, I guess I...

    I dont have a variable called sublist, I guess I need to create a new list_t pointer called sublist,

    sublist = make_empty_list ();

    to append list to sublist:

    list->foot->next = sublist->head
  16. Replies
    28
    Views
    3,961

    how to append sublist to list? thanks Salem

    how to append sublist to list?
    thanks Salem
  17. Replies
    28
    Views
    3,961

    thanks for the suggestions. I have re-written the...

    thanks for the suggestions. I have re-written the function and it is a semi working function :


    list_t *insert_into_list (list_t *list, bstree_t *sub_tree)
    {
    if (sub_tree == NULL)
    {...
  18. Replies
    28
    Views
    3,961

    The generic functions are from my lecturer and...

    The generic functions are from my lecturer and his style was to cast just to make the code easier to understand for noobiez like me, I have removerd them now.

    I dont understand what you mean I...
  19. Replies
    28
    Views
    3,961

    any one?

    I have this so far, but I'm getting a segfault...
    Please help me!


    list_t *insert_at_foot (list_t *list, char *value)
    {
    node_t *new;

    assert(list != NULL);
    new = (node_t *)...
  20. Replies
    28
    Views
    3,961

    algorithm for this fucntion ?

    the function list_t *matches(btree_t tree, char *prefix) takes a BST and searches it for phrases that begin with the same prefix, then inserts the phrases that match into a linked list in...
  21. tnx zacs7, I looked through the term, and...

    tnx zacs7, I looked through the term, and suddenly... it all became clearer.... and for casting malloc, Salem, point agreed, will ammend my code.
    qubz
  22. yes thanks Salem, I have a fully working...

    yes thanks Salem, I have a fully working function.

    I dont think that i can always terminate the string with a null within the loop because getc stops when it reaches the EOF, the loop is broken...
  23. It seems my code from the previous post is...

    It seems my code from the previous post is working!
    Thanks a billion to all those who coached/helped/advised me on this matter. :)

    Please comment if you think i can still further optimise my...
  24. char *get_line(FILE *file) { FILE *fp = file;...

    char *get_line(FILE *file)
    {
    FILE *fp = file;

    char *buffer;
    int ch, i=0;
    unsigned int buffer_size = BUFFER_SIZE, new_buffer_size;

    assert(buffer_size > 0);
  25. sorry : char *get_line(FILE *file) {...

    sorry :


    char *get_line(FILE *file)
    {
    FILE *fp = file;

    char *buffer;
    int ch, i=0;
    unsigned int buffer_size = BUFFER_SIZE, new_buffer_size;
Results 1 to 25 of 86
Page 1 of 4 1 2 3 4