链表
huohaifeng
这个作者很懒,什么都没留下…
展开
-
如何把链表逆序
#include using namespace std;typedef struct node{ int data; struct node *next;}Node;//怎么样把一个链表掉个顺序node * convert( Node * head ) { if( head == NULL ) { printf( "empty list!\n"); return NUL原创 2013-09-12 19:40:03 · 236 阅读 · 0 评论 -
链表相交、有环无环、交点等
struct int_List_Node{ int value; struct int_List_Node *next;};//判断两个无环链表是否相交bool is_crossed( struct int_List_Node * head1 , struct int_List_Node * head2 ) { if( ( head1 == NULL ) || ( head2 ==原创 2013-09-13 13:59:33 · 212 阅读 · 0 评论 -
输出单链表倒数第k个结点
//输出单链表倒数第k个结点struct int_List_Node{ int value; struct int_List_Node *next;};int count_back_k( const struct int_List_Node * L , const int k ) { struct int_List_Node *p = L; struct int_List_Nod原创 2013-09-14 18:43:42 · 243 阅读 · 0 评论