|
-
Nov 4th, 2001, 10:37 AM
#1
Thread Starter
Frenzied Member
need recursive function
I need a recursive function written in C that adds a Link list node on top of the previous. Can anyone help?
-
Nov 4th, 2001, 12:15 PM
#2
transcendental analytic
why recursive? is the link doubly linked? which end? search function? sorted?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 4th, 2001, 03:09 PM
#3
Thread Starter
Frenzied Member
here is the structure of the node
struct Node
{
int data;
Node *next;
};
typedef struct Node *Box;
int main()
{
Box head, temp;
}
I have to call recursivefunction out of main that will take an array as an argument and assign each element on top of the previous in the link list.
-
Nov 4th, 2001, 04:06 PM
#4
transcendental analytic
what is previous in the linked list?
Why not do it iteratively?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 10th, 2001, 03:30 AM
#5
Frenzied Member
Like a binary tree? Take a look at dynamictree.cpp on my
web page. It uses recursion to add and search nodes.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|