<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. 答案在風中飄蕩抒情作文

    時間:2025-11-13 08:12:57 1500字 我要投稿

    答案在風中飄蕩抒情作文范文

      1、OSI七層模型

    答案在風中飄蕩抒情作文范文

      2物理層3數據鏈路層4網絡層5傳輸層6會話層7表示層8應用層

      2、進程間數據共享的方式三種

      文件映射

      共享內存

      信號

      匿名管道

      命名管道

      郵件槽

      剪貼板

      3、TCP/UDP區別

      4、打印數組的所有組合

      [cpp] view plaincopyprint?

      #include

      int n = 0;

      void swap(int *a, int *b)

      {

      int m;

      m = *a;

      *a = *b;

      *b = m;

      }

      void perm(int list[], int k, int m)

      {

      int i;

      if(k > m)

      {

      for(i = 0; i <= m; i++)

      printf("%d ", list[i]);

      printf(" ");

      n++;

      }

      else

      {

      for(i = k; i <= m; i++)

      {

      swap(&list[k], &list[i]);

      perm(list, k + 1, m);

      swap(&list[k], &list[i]);

      }

      }

      }

      int main()

      {

      int list[] = {1, 2, 3, 4, 5};

      perm(list, 0, 4);

      printf("total:%d ", n);

      return 0;

      }

      #include

      int n = 0;

      void swap(int *a, int *b)

      {

      int m;

      m = *a;

      *a = *b;

      *b = m;

      }

      void perm(int list[], int k, int m)

      {

      int i;

      if(k > m)

      {

      for(i = 0; i <= m; i++)

      printf("%d ", list[i]);

      printf(" ");

      n++;

      }

      else

      {

      for(i = k; i <= m; i++)

      {

      swap(&list[k], &list[i]);

      perm(list, k + 1, m);

      swap(&list[k], &list[i]);

      }

      }

      }

      int main()

      {

      int list[] = {1, 2, 3, 4, 5};

      perm(list, 0, 4);

      printf("total:%d ", n);

      return 0;

      }

      二進制

      首先,把數組每一個元素用一個二進位表示,例如:

      A B C D E

      1 1 1 1 1 ---> 于是它最多有11111(二進制)種不重復組合(即31種)(不考慮順序--按樓主要求)

      于是,只要檢查從1到31這些數字的二進位哪些是二進制值1,就可以得出組合了。(位值為1的元素選取,位值為0的元素棄之)

      (轉自網絡)

      5、二叉樹的面積

      深度優先搜索,廣度優先搜索的實現

      [cpp] view plaincopyprint?

      #include

      #include

      #include

      #define TRUE 1

      #define FLASE 0

      #define OK 1

      #define ERROR 0

      #define INFEASIBLE -1

      #define OVERFLOW -2

      typedef int Status;

      typedef int TElemType;

      typedef struct BiTNode

      {

      TElemType data;

      struct BiTNode *lchild,*rchild;

      } BiTNode,*BiTree;

      Status CreateBiTree(BiTree &T)

      {

      TElemType e;

      scanf("%d",&e);

      if(e==0) T=NULL;

      else

      {

      T=(BiTree)malloc(sizeof(BiTNode));

      if(!T)

      exit(OVERFLOW);

      T->data =e;

      CreateBiTree(T->lchild );

      CreateBiTree(T->rchild );

      }

      return OK;

      }

      int max(int a[])

      {

      int max,i;

      max=a[0];

      for(i=1;i<20;i++)

      {

      if(max

      max=a[i];

      }

      return max;

      }

      int BiTreeWidth (BiTree T)

      {

      if(T==NULL)

      return 0;

      else

      {

      static int a[20]={0};

      static int i=0;

      a[i]++;

      i++;

      BiTreeWidth (T->lchild );

      if(T->lchild ==NULL)

      i--;

      BiTreeWidth (T->rchild );

      if(T->rchild ==NULL)

      i--;

      return max(a);

      }

      }

      #include

      #include

      #include

      #define TRUE 1

      #define FLASE 0

      #define OK 1

      #define ERROR 0

      #define INFEASIBLE -1

      #define OVERFLOW -2

      typedef int Status;

      typedef int TElemType;

      typedef struct BiTNode

      {

      TElemType data;

      struct BiTNode *lchild,*rchild;

      } BiTNode,*BiTree;

      Status CreateBiTree(BiTree &T)

      {

      TElemType e;

      scanf("%d",&e);

      if(e==0) T=NULL;

      else

      {

      T=(BiTree)malloc(sizeof(BiTNode));

      if(!T)

      exit(OVERFLOW);

      T->data =e;

      CreateBiTree(T->lchild );

      CreateBiTree(T->rchild );

      }

      return OK;

      }

      int max(int a[])

      {

      int max,i;

      max=a[0];

      for(i=1;i<20;i++)

      {

      if(max

      max=a[i];

      }

      return max;

      }

      int BiTreeWidth (BiTree T)

      {

      if(T==NULL)

      return 0;

      else

      {

      static int a[20]={0};

      static int i=0;

      a[i]++;

      i++;

      BiTreeWidth (T->lchild );

      if(T->lchild ==NULL)

      i--;

      BiTreeWidth (T->rchild );

      if(T->rchild ==NULL)

      i--;

      return max(a);

      }

      }

      另附:

      二叉樹高度、寬度、結點個數、葉子結點個數

      實現二叉樹寬度遞歸算法~

      #include

      using namespace std;

      typedef struct node

      {

      char data;

      int lab;

      struct node *lchild;

      struct node *rchild;

      }btree;

      int m=0;

      void ct(btree *&b,char *str)

      {

      btree *st[99],*p=NULL;

      int top=-1,k,j=0;

      char ch;

      b=NULL;

      ch=str[j];

      while(ch!='\0')

      {

      switch(ch)

      {

      case '(':top++;st[top]=p;k=1;break;

      case ')':top--;break;

      case ',':k=2;break;

      default:p=(btree *)malloc(sizeof(btree));

      p->data=ch;

      p->lchild=p->rchild=NULL;

      if(b==NULL)

      b=p;

      else

      {

      switch(k)

      {

      case 1:st[top]->lchild=p;break;

      case 2:st[top]->rchild=p;break;

      }

      }

      }

      j++;

      ch=str[j];

      }

      }

      void outbt(btree *b)

      {

      if(b!=NULL)

      {

      cout<data;

      outbt(b->lchild);

      outbt(b->rchild);

      }

      }

      btree *findchild(btree *b,char x)

      {

      btree *p;

      if(b==NULL)

      {

      return NULL;

      }

      else

      if(b->data==x)

      {

      cout<<"找到結點"<

      if(b->lchild==NULL)

      cout<<"左節點為空!"<

      else

      cout<<"左孩子為:"<lchild->data<

      if(b->rchild==NULL)

      cout<<"右孩子為空!"<

      else

      cout<<"右孩子為:"<rchild->data<

      return b;

      }

      else

      {

      p=findchild(b->lchild,x);

      if(p!=NULL)

      return p;

      else

      return findchild(b->rchild,x);

      }

      }

      int btreeheight(btree *b)

      {

      int lchildh,rchildh;

      if(b==NULL)

      return(0);

      else

      {

      lchildh=btreeheight(b->lchild);

      rchildh=btreeheight(b->rchild);

      return(lchildh>rchildh?(lchildh+1):(rchildh+1));

      }

      }

      int i=-1,a[20];

      void btreewide(btree *b)

      {

      if(b!=NULL)

      {

      if(b->lchild!=NULL)

      {

      i++;

      b->lchild->lab=b->lab+1;

      a[i]=b->lab+1;

      }

      if(b->rchild!=NULL)

      {

      i++;

      b->rchild->lab=b->lab+1;

      a[i]=b->lab+1;

      }

      btreewide(b->lchild);

      btreewide(b->rchild);

      }

      }

      void vernum(btree *b)

      {

      if(b!=NULL)

      {

      m++;

      vernum(b->lchild);

      vernum(b->rchild);

      }

      }

      int leafver(btree *b)

      {

      if(b==NULL)

      return 0;

      else

      if(b->lchild==NULL&&b->rchild==NULL)

      return 1;

      else

      return leafver(b->lchild)+leafver(b->rchild);

      }

      void main()

      {

      char *s;

      s="A(B(D,E(H(J,K(L,M(,N))))),C(F,G(,I)))";

      btree *bt;

      cout<<"將要創建的二叉樹:"<

      ct(bt,s);

      cout<<"輸出二叉樹:"<

      outbt(bt);

      cout<

      cout<<"H結點左右孩子結點值:"<

      findchild(bt,'H');

      cout<<"二叉樹的深度:"<

      vernum(bt);

      cout<<"二叉樹結點個數:"<

      cout<<"二叉樹葉子結點個數:"<

      bt->lab=1;

      btreewide(bt);

      int j,k,num,max=0;

      for(j=1;j<=i+1;j++)

      {

      num=0;

      for(k=0;k<=i;k++)

      if(a[k]==j)

      num++;

      if(max

      {

      max=num;

      }

      }

      cout<<"二叉樹寬度為:"<

      }

      實現二叉樹寬度遞歸算法~

      #include

      using namespace std;

      typedef struct node

      {

      char data;

      int lab;

      struct node *lchild;

      struct node *rchild;

      }btree;

      int m=0;

      void ct(btree *&b,char *str)

      {

      btree *st[99],*p=NULL;

      int top=-1,k,j=0;

      char ch;

      b=NULL;

      ch=str[j];

      while(ch!='\0')

      {

      switch(ch)

      {

      case '(':top++;st[top]=p;k=1;break;

      case ')':top--;break;

      case ',':k=2;break;

      default:p=(btree *)malloc(sizeof(btree));

      p->data=ch;

      p->lchild=p->rchild=NULL;

      if(b==NULL)

      b=p;

      else

      {

      switch(k)

      {

      case 1:st[top]->lchild=p;break;

      case 2:st[top]->rchild=p;break;

      }

      }

      }

      j++;

      ch=str[j];

      }

      }

      void outbt(btree *b)

      {

      if(b!=NULL)

      {

      cout<data;

      outbt(b->lchild);

      outbt(b->rchild);

      }

      }

      btree *findchild(btree *b,char x)

      {

      btree *p;

      if(b==NULL)

      {

      return NULL;

      }

      else

      if(b->data==x)

      {

      cout<<"找到結點"<

      if(b->lchild==NULL)

      cout<<"左節點為空!"<

      else

      cout<<"左孩子為:"<lchild->data<

      if(b->rchild==NULL)

      cout<<"右孩子為空!"<

      else

      cout<<"右孩子為:"<rchild->data<

      return b;

      }

      else

      {

      p=findchild(b->lchild,x);

      if(p!=NULL)

      return p;

      else

      return findchild(b->rchild,x);

      }

      }

      int btreeheight(btree *b)

      {

      int lchildh,rchildh;

      if(b==NULL)

      return(0);

      else

      {

      lchildh=btreeheight(b->lchild);

      rchildh=btreeheight(b->rchild);

      return(lchildh>rchildh?(lchildh+1):(rchildh+1));

      }

      }

      int i=-1,a[20];

      void btreewide(btree *b)

      {

      if(b!=NULL)

      {

      if(b->lchild!=NULL)

      {

      i++;

      b->lchild->lab=b->lab+1;

      a[i]=b->lab+1;

      }

      if(b->rchild!=NULL)

      {

      i++;

      b->rchild->lab=b->lab+1;

      a[i]=b->lab+1;

      }

      btreewide(b->lchild);

      btreewide(b->rchild);

      }

      }

      void vernum(btree *b)

      {

      if(b!=NULL)

      {

      m++;

      vernum(b->lchild);

      vernum(b->rchild);

      }

      }

      int leafver(btree *b)

      {

      if(b==NULL)

      return 0;

      else

      if(b->lchild==NULL&&b->rchild==NULL)

      return 1;

      else

      return leafver(b->lchild)+leafver(b->rchild);

      }

      void main()

      {

      char *s;

      s="A(B(D,E(H(J,K(L,M(,N))))),C(F,G(,I)))";

      btree *bt;

      cout<<"將要創建的二叉樹:"<

      ct(bt,s);

      cout<<"輸出二叉樹:"<

      outbt(bt);

      cout<

      cout<<"H結點左右孩子結點值:"<

      findchild(bt,'H');

      cout<<"二叉樹的深度:"<

      vernum(bt);

      cout<<"二叉樹結點個數:"<

      cout<<"二叉樹葉子結點個數:"<

      bt->lab=1;

      btreewide(bt);

      int j,k,num,max=0;

      for(j=1;j<=i+1;j++)

      {

      num=0;

      for(k=0;k<=i;k++)

      if(a[k]==j)

      num++;

      if(max

      {

      max=num;

      }

      }

      cout<<"二叉樹寬度為:"<

      }

      6、地圖的點的文字位置的確定

      1、掃描點附近的矩形鄰域內是否為空

      2改進:搜索算法

    【答案在風中飄蕩抒情作文】相關文章:

    答案在風中飄蕩作文09-03

    答案在風中飄蕩創新作文05-07

    有關答案在風中飄蕩征文(精選23篇)01-06

    讓和平在風中飄蕩作文04-04

    答案在風中飄蕩創新作文[精]06-29

    最新答案在風中飄蕩創新作文06-29

    小學生答案在風中飄蕩作文(精選24篇)12-30

    答案在風中飄蕩創新作文高中版03-05

    讓和平在風中飄蕩作文(精選18篇)09-12

    答案在風中飄蕩創新作文700字(通用12篇)07-11

    • 相關推薦
    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人