Thread: Avl tree help

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    1

    Post Avl tree help

    can anyone implement these two functions ?
    Code:
    int avl_insert(avl_t * tree, avl_key_t key, data_t data) 
    
    data_t avl_remove (avl_t *tree, avl_key_t key)
    
    giving this struct
    
    typedef void * data_t;
    
    
    
    
    typedef struct avl_node_tag{ 
       data_t data_ptr;
    
       avl_key_t key;
    
       struct avl_node_tag * left;
    
       struct avl_node_tag * right;
       int height;
    
    }  avl_node_t;
    
    
    
    typedef struct avl_tag{ 
       avl_node_t * root;
    
       int tree_size;
       AVLComparator comparator;
    
       int num_recent_key_comparisons;
    
    }  avl_t;

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > can anyone implement these two functions ?
    Yes, but that isn't the point of homework is it?

    You "attempt", we "help".

    Not "you dump assignment and go party" and we "spend hours getting you a good grade".
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    But what is an AVL tree doing in the AI section?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Good point - moved.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  2. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 09:09 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM

Tags for this Thread