当前位置: 首页> 教育> 幼教 > 免费手机客服系统_网络游戏排行榜2022_怎么去做推广_seo优化技术排名

免费手机客服系统_网络游戏排行榜2022_怎么去做推广_seo优化技术排名

时间:2025/7/26 18:20:00来源:https://blog.csdn.net/LegendApple/article/details/145840282 浏览次数:0次
免费手机客服系统_网络游戏排行榜2022_怎么去做推广_seo优化技术排名

#include <bits/stdc++.h>
using namespace std;
typedef struct Node{
    int data;
    struct Node *next;
}Node;

Node *getNewNode(int val){
    Node *p=(Node*)malloc(sizeof(Node));
    p->data=val;
    p->next=p;
    return p;
}

Node *insert(Node *head,int pos,int val){
    if(pos==0){
        Node *p=getNewNode(val);
        p->next=head;
        return p;
    }
    Node *p=head;
    for(int i=1;i<pos;i++)p=p->next;
    Node *node=getNewNode(val);
    node->next=p->next;
    p->next=node;
    return head;
}

void clear(Node *head){
    if(head==NULL)return ;
    for(Node *p=head,*q;p;p=q){
        q=p->next;
        free(p);
    }
    return ;
}

void output_linklist(Node *head){
    int n=0;
    for(Node *p=head;p;p=p->next)n+=1;
    for(int i=0;i<n;i++){
        cout<<i<<"  ";
    }
    cout<<endl;
    for(Node *p=head;p;p=p->next){
        cout<<p->data<<"->";
    }
    cout<<endl<<endl<<endl;
    return ;
}

int find(Node* head,int val){
    Node* p=head;
    int n=0;
    while(p){
        if(p->data==val){
            output_linklist(head);
            int len=n*4;
            for(int i=0;i<len;i++){
                cout<<" ";
            }
            cout<<"^\n";
            for(int i=0;i<len;i++){
                cout<<" ";
            }
            cout<<"|\n";
            return 1;
    }
        n++;
        p=p->next;
    }
    return 0;

int main(){
    srand(time(0));
    #define MAX_OP 5
    Node *head=NULL;
    for(int i=0;i<MAX_OP;i++){
        int pos=rand()%(i+1),val=rand()%100,ret;
        cout<<"insert "<<pos<<" at "<<val<<"|";
        head=insert(head,pos,val);
        output_linklist(head);
    }
    int val;
    while(cin>>val){
        if(!find(head,val)){
            cout<<"not found\n";
        }
    }
    clear(head);
    return 0;
}

关键字:免费手机客服系统_网络游戏排行榜2022_怎么去做推广_seo优化技术排名

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: