What are the differences between a linked list and a binary tree...And also what one is better...
Thank you any help is much needed...
Scotty:o :mad:
Printable View
What are the differences between a linked list and a binary tree...And also what one is better...
Thank you any help is much needed...
Scotty:o :mad:
Linked List
Code:|
|
|
|
|
Binary Tree
Code:|
/ \
/\ /\
Linked List
Code:class NODE
{ NODE* next;
int data;
}
Binary Tree
Code:class NODE
{ NODE* left;
NODE* right;
int data;
}
I have the meaning of the to different types but what is the difference...
Scotty:)
Linked lists are generally not sorted, and are fast to insert things into, regardless of their size, but searching them is very slow. Binary trees are generally sorted, have slower insertion times (albeit not that slow), but searching them is just as fast as insertion.