building a linked list from tree leaf nodes

This is a discussion on building a linked list from tree leaf nodes within the C Programming forums, part of the General Programming Boards category; hii , I'll appreciate it if someone please help me with this problem I want to create a linked-list from ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    2

    Unhappy building a linked list from tree leaf nodes

    hii , I'll appreciate it if someone please help me with this problem
    I want to create a linked-list from the leaves of a tree ordered from right to left .
    without using a Static or global variable

    typedef struct t_node {
    int data;
    struct t_node *left;
    struct t_node *right;
    } T_NODE;


    typedef struct list_node
    {
    int data;
    struct list_node *next;
    } L_NODE;

    the function header : L_NODE* leavesRightToLeft (T_NODE* root, 1 more variable )
    for example :

    Code:
                                      3
                                    /    \
                                   2      5
                                   \    /  \
                                    4   7   9
                                            /
                                           1
    and the function will return a pointer to linked list that will be as following :
    1 -> 7 -> 4
    Last edited by ayman88; 02-27-2010 at 03:26 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked List Not Saving Value as Int
    By bar338 in forum C Programming
    Replies: 4
    Last Post: 05-04-2009, 07:53 PM
  2. swapping nodes in double linked list
    By a0161 in forum C Programming
    Replies: 15
    Last Post: 10-30-2008, 06:12 PM
  3. help! Placement of nodes in a Linked List
    By lostmyshadow in forum C Programming
    Replies: 6
    Last Post: 12-17-2007, 12:21 PM
  4. How can I traverse a huffman tree
    By carrja99 in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2003, 05:46 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21