轩辕

运筹帷幄世界在我手中!

导航

2013年2月23日 #

单链的逆置

摘要: node *reverse(node *head){node *p1,*p2,*p3;if(head==NULL||head->next==NULL)return head;p1=head,p2=p1->next;while(p2){p3=p2->next;p2->next=p1;p1=p2;p2=p3;}head->next=NULL;head=p1;return head;}int main(){node *head,stud;int n,del,num,insert_num;head=create();print(head);cout<<&quo 阅读全文

posted @ 2013-02-23 12:10 峻华 阅读(110) 评论(0) 推荐(0)

单链表排序

摘要: node *sort(node *head){node *p,*p2,*p3;int n;int temp;n=length(head);if(head==NULL||head->next==NULL)return head;p=head;for(int j=1;j<n;++j){p=head;for(int i=0;i<n-j;++i){if(p->data>p->next->data){temp=p->data;p->data=p->next->data;p->next->data=temp;}p=p->n 阅读全文

posted @ 2013-02-23 12:01 峻华 阅读(87) 评论(0) 推荐(0)

单链表删除节点

摘要: node *del(node *head,int num){node *p1,*p2;p1=head;while(num!=p1->data&&p1->next!=NULL){p2=p1; p1=p1->next;}if(num==p1->data){if(p1==head){head=p1->next;free(p1);elsep2->next=p1->next;}elseprintf("\n%d could not been found".num);return (head);} 阅读全文

posted @ 2013-02-23 11:56 峻华 阅读(77) 评论(0) 推荐(0)

实现单链表的建立/测长/打印

摘要: #include<iostream>#include<stdio.h>#include<string.h>#include<conio.h>using namespace std;typedef struct student{int data;struct student *next;}node;node *creat(){node *head,*p,*s;int x,cycle=1;head=(node*)malloc(sizeof(node));p=head;while(cycle){printf("\n please input 阅读全文

posted @ 2013-02-23 11:51 峻华 阅读(121) 评论(0) 推荐(0)

应用Jsoup解析给定的某个URL地址、HTML文本内容。

摘要: 首先下载jsoup的jar包,然后在新建的工程里导入jsoup包。再编译就可以了packageexample;importjava.io.IOException;importorg.jsoup.Jsoup;importorg.jsoup.nodes.Document;importorg.jsoup.nodes.Element;importorg.jsoup.select.Elements;publicclassscreenscrape{/***@paramargs*/publicstaticvoidmain(String[]args)throwsIOException{Documentdoc= 阅读全文

posted @ 2013-02-23 11:50 峻华 阅读(2399) 评论(0) 推荐(0)