C/C++,树算法——Ukkonen的“后缀树“构造算法的源程序

1 文本格式

// A C program to implement Ukkonen's Suffix Tree Construction
// And then build generalized suffix tree
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_CHAR 256

struct SuffixTreeNode {
    struct SuffixTreeNode *children[MAX_CHAR];

    //pointer to other node via suffix link
    struct SuffixTreeNode *suffixLink;

    /*(start, end) interval specifies the edge, by which the
    node is connected to its parent node. Each edge will
    connect two nodes, one parent and one child, and
    (start, end) interval of a given edge will be stored
    in the child node. Lets say there are two nods A and B
    connected by an edge with indices (5, 8) then this
    indices (5, 8) will be stored in node B. */
    int start;
    int *end;

    /*for leaf nodes, it stores the index of suffix for
    the path from root to leaf*/
    int suffixIndex;
};

typedef struct SuffixTreeNode Node;

char text[100]; //Input string
Node *root = NULL; //Pointer to root node

/*lastNewNode will point to newly created internal node,
waiting for it's suffix link to be set, which might get
a new suffix link (other than root) in next extension of
same phase. lastNewNode will be set to NULL when last
newly created internal node (if there is any) got it's
suffix link reset to new internal node created in next
extension of same phase. */
Node *lastNewNode = NULL;
Node *activeNode = NULL;

/*activeEdge is represented as input string character
index (not the character itself)*/
int activeEdge = -1;
int activeLength = 0;

// remainingSuffixCount tells how many suffixes yet to
// be added in tree
int remainingSuffixCount = 0;
int leafEnd = -1;
int *rootEnd = NULL;
int *splitEnd = NULL;
int size = -1; //Length of input string

Node *newNode(int start, int *end)
{
    Node *node =(Node*) malloc(sizeof(Node));
    int i;
    for (i = 0; i < MAX_CHAR; i++)
        node->children[i] = NULL;

    /*For root node, suffixLink will be set to NULL
    For internal nodes, suffixLink will be set to root
    by default in current extension and may change in
    next extension*/
    node->suffixLink = root;
    node->start = start;
    node->end = end;

    /*suffixIndex will be set to -1 by default and
    actual suffix index will be set later for leaves
    at the end of all phases*/
    node->suffixIndex = -1;
    return node;
}

int edgeLength(Node *n) {
    if(n == root)
        return 0;
    return *(n->end) - (n->start) + 1;
}

int walkDown(Node *currNode)
{
    /*activePoint change for walk down (APCFWD) using
    Skip/Count Trick (Trick 1). If activeLength is greater
    than current edge length, set next internal node as
    activeNode and adjust activeEdge and activeLength
    accordingly to represent same activePoint*/
    if (activeLength >= edgeLength(currNode))
    {
        activeEdge += edgeLength(currNode);
        activeLength -= edgeLength(currNode);
        activeNode = currNode;
        return 1;
    }
    return 0;
}

void extendSuffixTree(int pos)
{
    /*Extension Rule 1, this takes care of extending all
    leaves created so far in tree*/
    leafEnd = pos;

    /*Increment remainingSuffixCount indicating that a
    new suffix added to the list of suffixes yet to be
    added in tree*/
    remainingSuffixCount++;

    /*set lastNewNode to NULL while starting a new phase,
    indicating there is no internal node waiting for
    it's suffix link reset in current phase*/
    lastNewNode = NULL;

    //Add all suffixes (yet to be added) one by one in tree
    while(remainingSuffixCount > 0) {

        if (activeLength == 0)
            activeEdge = pos; //APCFALZ

        // There is no outgoing edge starting with
        // activeEdge from activeNode
        if (activeNode->children] == NULL)
        {
            //Extension Rule 2 (A new leaf edge gets created)
            activeNode->children] =
                                        newNode(pos, &leafEnd);

            /*A new leaf edge is created in above line starting
            from an existing node (the current activeNode), and
            if there is any internal node waiting for it's suffix
            link get reset, point the suffix link from that last
            internal node to current activeNode. Then set lastNewNode
            to NULL indicating no more node waiting for suffix link
            reset.*/
            if (lastNewNode != NULL)
            {
                lastNewNode->suffixLink = activeNode;
                lastNewNode = NULL;
            }
        }
        // There is an outgoing edge starting with activeEdge
        // from activeNode
        else
        {
            // Get the next node at the end of edge starting
            // with activeEdge
            Node *next = activeNode->children];
            if (walkDown(next))//Do walkdown
            {
                //Start from next node (the new activeNode)
                continue;
            }
            /*Extension Rule 3 (current character being processed
            is already on the edge)*/
            if (text[next->start + activeLength] == text[pos])
            {
                //If a newly created node waiting for it's
                //suffix link to be set, then set suffix link
                //of that waiting node to current active node
                if(lastNewNode != NULL && activeNode != root)
                {
                    lastNewNode->suffixLink = activeNode;
                    lastNewNode = NULL;
                }

                //APCFER3
                activeLength++;
                /*STOP all further processing in this phase
                and move on to next phase*/
                break;
            }

            /*We will be here when activePoint is in middle of
            the edge being traversed and current character
            being processed is not on the edge (we fall off
            the tree). In this case, we add a new internal node
            and a new leaf edge going out of that new node. This
            is Extension Rule 2, where a new leaf edge and a new
            internal node get created*/
            splitEnd = (int*) malloc(sizeof(int));
            *splitEnd = next->start + activeLength - 1;

            //New internal node
            Node *split = newNode(next->start, splitEnd);
            activeNode->children] = split;

            //New leaf coming out of new internal node
            split->children] = newNode(pos, &leafEnd);
            next->start += activeLength;
            split->children] = next;

            /*We got a new internal node here. If there is any
            internal node created in last extensions of same
            phase which is still waiting for it's suffix link
            reset, do it now.*/
            if (lastNewNode != NULL)
            {
            /*suffixLink of lastNewNode points to current newly
            created internal node*/
                lastNewNode->suffixLink = split;
            }

            /*Make the current newly created internal node waiting
            for it's suffix link reset (which is pointing to root
            at present). If we come across any other internal node
            (existing or newly created) in next extension of same
            phase, when a new leaf edge gets added (i.e. when
            Extension Rule 2 applies is any of the next extension
            of same phase) at that point, suffixLink of this node
            will point to that internal node.*/
            lastNewNode = split;
        }

        /* One suffix got added in tree, decrement the count of
        suffixes yet to be added.*/
        remainingSuffixCount--;
        if (activeNode == root && activeLength > 0) //APCFER2C1
        {
            activeLength--;
            activeEdge = pos - remainingSuffixCount + 1;
        }
        else if (activeNode != root) //APCFER2C2
        {
            activeNode = activeNode->suffixLink;
        }
    }
}

void print(int i, int j)
{
    int k;
    for (k=i; k<=j && text[k] != '#'; k++)
        printf("%c", text[k]);
    if(k<=j)
        printf("#");
}

//Print the suffix tree as well along with setting suffix index
//So tree will be printed in DFS manner
//Each edge along with it's suffix index will be printed
void setSuffixIndexByDFS(Node *n, int labelHeight)
{
    if (n == NULL) return;

    if (n->start != -1) //A non-root node
    {
        //Print the label on edge from parent to current node
        print(n->start, *(n->end));
    }
    int leaf = 1;
    int i;
    for (i = 0; i < MAX_CHAR; i++)
    {
        if (n->children[i] != NULL)
        {
            if (leaf == 1 && n->start != -1)
                printf(" [%d]\n", n->suffixIndex);

            //Current node is not a leaf as it has outgoing
            //edges from it.
            leaf = 0;
            setSuffixIndexByDFS(n->children[i], labelHeight +
                                edgeLength(n->children[i]));
        }
    }
    if (leaf == 1)
    {
        for(i= n->start; i<= *(n->end); i++)
        {
            if(text[i] == '#') //Trim unwanted characters
            {
                n->end = (int*) malloc(sizeof(int));
                *(n->end) = i;
            }
        }
        n->suffixIndex = size - labelHeight;
        printf(" [%d]\n", n->suffixIndex);
    }
}

void freeSuffixTreeByPostOrder(Node *n)
{
    if (n == NULL)
        return;
    int i;
    for (i = 0; i < MAX_CHAR; i++)
    {
        if (n->children[i] != NULL)
        {
            freeSuffixTreeByPostOrder(n->children[i]);
        }
    }
    if (n->suffixIndex == -1)
        free(n->end);
    free(n);
}

/*Build the suffix tree and print the edge labels along with
suffixIndex. suffixIndex for leaf edges will be >= 0 and
for non-leaf edges will be -1*/
void buildSuffixTree()
{
    size = strlen(text);
    int i;
    rootEnd = (int*) malloc(sizeof(int));
    *rootEnd = - 1;

    /*Root is a special node with start and end indices as -1,
    as it has no parent from where an edge comes to root*/
    root = newNode(-1, rootEnd);

    activeNode = root; //First activeNode will be root
    for (i=0; i<size; i++)
        extendSuffixTree(i);
    int labelHeight = 0;
    setSuffixIndexByDFS(root, labelHeight);

    //Free the dynamically allocated memory
    freeSuffixTreeByPostOrder(root);
}

// driver program to test above functions
int main(int argc, char *argv[])
{
// strcpy(text, "xabxac#abcabxabcd$"); buildSuffixTree();
    strcpy(text, "xabxa#babxba$"); buildSuffixTree();
    return 0;
}

2 代码格式

// A C program to implement Ukkonen's Suffix Tree Construction
// And then build generalized suffix tree
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_CHAR 256struct SuffixTreeNode {struct SuffixTreeNode *children[MAX_CHAR];//pointer to other node via suffix linkstruct SuffixTreeNode *suffixLink;/*(start, end) interval specifies the edge, by which thenode is connected to its parent node. Each edge willconnect two nodes, one parent and one child, and(start, end) interval of a given edge will be storedin the child node. Lets say there are two nods A and Bconnected by an edge with indices (5, 8) then thisindices (5, 8) will be stored in node B. */int start;int *end;/*for leaf nodes, it stores the index of suffix forthe path from root to leaf*/int suffixIndex;
};typedef struct SuffixTreeNode Node;char text[100]; //Input string
Node *root = NULL; //Pointer to root node/*lastNewNode will point to newly created internal node,
waiting for it's suffix link to be set, which might get
a new suffix link (other than root) in next extension of
same phase. lastNewNode will be set to NULL when last
newly created internal node (if there is any) got it's
suffix link reset to new internal node created in next
extension of same phase. */
Node *lastNewNode = NULL;
Node *activeNode = NULL;/*activeEdge is represented as input string character
index (not the character itself)*/
int activeEdge = -1;
int activeLength = 0;// remainingSuffixCount tells how many suffixes yet to
// be added in tree
int remainingSuffixCount = 0;
int leafEnd = -1;
int *rootEnd = NULL;
int *splitEnd = NULL;
int size = -1; //Length of input stringNode *newNode(int start, int *end)
{Node *node =(Node*) malloc(sizeof(Node));int i;for (i = 0; i < MAX_CHAR; i++)node->children[i] = NULL;/*For root node, suffixLink will be set to NULLFor internal nodes, suffixLink will be set to rootby default in current extension and may change innext extension*/node->suffixLink = root;node->start = start;node->end = end;/*suffixIndex will be set to -1 by default andactual suffix index will be set later for leavesat the end of all phases*/node->suffixIndex = -1;return node;
}int edgeLength(Node *n) {if(n == root)return 0;return *(n->end) - (n->start) + 1;
}int walkDown(Node *currNode)
{/*activePoint change for walk down (APCFWD) usingSkip/Count Trick (Trick 1). If activeLength is greaterthan current edge length, set next internal node asactiveNode and adjust activeEdge and activeLengthaccordingly to represent same activePoint*/if (activeLength >= edgeLength(currNode)){activeEdge += edgeLength(currNode);activeLength -= edgeLength(currNode);activeNode = currNode;return 1;}return 0;
}void extendSuffixTree(int pos)
{/*Extension Rule 1, this takes care of extending allleaves created so far in tree*/leafEnd = pos;/*Increment remainingSuffixCount indicating that anew suffix added to the list of suffixes yet to beadded in tree*/remainingSuffixCount++;/*set lastNewNode to NULL while starting a new phase,indicating there is no internal node waiting forit's suffix link reset in current phase*/lastNewNode = NULL;//Add all suffixes (yet to be added) one by one in treewhile(remainingSuffixCount > 0) {if (activeLength == 0)activeEdge = pos; //APCFALZ// There is no outgoing edge starting with// activeEdge from activeNodeif (activeNode->children] == NULL){//Extension Rule 2 (A new leaf edge gets created)activeNode->children] =newNode(pos, &leafEnd);/*A new leaf edge is created in above line startingfrom an existing node (the current activeNode), andif there is any internal node waiting for it's suffixlink get reset, point the suffix link from that lastinternal node to current activeNode. Then set lastNewNodeto NULL indicating no more node waiting for suffix linkreset.*/if (lastNewNode != NULL){lastNewNode->suffixLink = activeNode;lastNewNode = NULL;}}// There is an outgoing edge starting with activeEdge// from activeNodeelse{// Get the next node at the end of edge starting// with activeEdgeNode *next = activeNode->children];if (walkDown(next))//Do walkdown{//Start from next node (the new activeNode)continue;}/*Extension Rule 3 (current character being processedis already on the edge)*/if (text[next->start + activeLength] == text[pos]){//If a newly created node waiting for it's//suffix link to be set, then set suffix link//of that waiting node to current active nodeif(lastNewNode != NULL && activeNode != root){lastNewNode->suffixLink = activeNode;lastNewNode = NULL;}//APCFER3activeLength++;/*STOP all further processing in this phaseand move on to next phase*/break;}/*We will be here when activePoint is in middle ofthe edge being traversed and current characterbeing processed is not on the edge (we fall offthe tree). In this case, we add a new internal nodeand a new leaf edge going out of that new node. Thisis Extension Rule 2, where a new leaf edge and a newinternal node get created*/splitEnd = (int*) malloc(sizeof(int));*splitEnd = next->start + activeLength - 1;//New internal nodeNode *split = newNode(next->start, splitEnd);activeNode->children] = split;//New leaf coming out of new internal nodesplit->children] = newNode(pos, &leafEnd);next->start += activeLength;split->children] = next;/*We got a new internal node here. If there is anyinternal node created in last extensions of samephase which is still waiting for it's suffix linkreset, do it now.*/if (lastNewNode != NULL){/*suffixLink of lastNewNode points to current newlycreated internal node*/lastNewNode->suffixLink = split;}/*Make the current newly created internal node waitingfor it's suffix link reset (which is pointing to rootat present). If we come across any other internal node(existing or newly created) in next extension of samephase, when a new leaf edge gets added (i.e. whenExtension Rule 2 applies is any of the next extensionof same phase) at that point, suffixLink of this nodewill point to that internal node.*/lastNewNode = split;}/* One suffix got added in tree, decrement the count ofsuffixes yet to be added.*/remainingSuffixCount--;if (activeNode == root && activeLength > 0) //APCFER2C1{activeLength--;activeEdge = pos - remainingSuffixCount + 1;}else if (activeNode != root) //APCFER2C2{activeNode = activeNode->suffixLink;}}
}void print(int i, int j)
{int k;for (k=i; k<=j && text[k] != '#'; k++)printf("%c", text[k]);if(k<=j)printf("#");
}//Print the suffix tree as well along with setting suffix index
//So tree will be printed in DFS manner
//Each edge along with it's suffix index will be printed
void setSuffixIndexByDFS(Node *n, int labelHeight)
{if (n == NULL) return;if (n->start != -1) //A non-root node{//Print the label on edge from parent to current nodeprint(n->start, *(n->end));}int leaf = 1;int i;for (i = 0; i < MAX_CHAR; i++){if (n->children[i] != NULL){if (leaf == 1 && n->start != -1)printf(" [%d]\n", n->suffixIndex);//Current node is not a leaf as it has outgoing//edges from it.leaf = 0;setSuffixIndexByDFS(n->children[i], labelHeight +edgeLength(n->children[i]));}}if (leaf == 1){for(i= n->start; i<= *(n->end); i++){if(text[i] == '#') //Trim unwanted characters{n->end = (int*) malloc(sizeof(int));*(n->end) = i;}}n->suffixIndex = size - labelHeight;printf(" [%d]\n", n->suffixIndex);}
}void freeSuffixTreeByPostOrder(Node *n)
{if (n == NULL)return;int i;for (i = 0; i < MAX_CHAR; i++){if (n->children[i] != NULL){freeSuffixTreeByPostOrder(n->children[i]);}}if (n->suffixIndex == -1)free(n->end);free(n);
}/*Build the suffix tree and print the edge labels along with
suffixIndex. suffixIndex for leaf edges will be >= 0 and
for non-leaf edges will be -1*/
void buildSuffixTree()
{size = strlen(text);int i;rootEnd = (int*) malloc(sizeof(int));*rootEnd = - 1;/*Root is a special node with start and end indices as -1,as it has no parent from where an edge comes to root*/root = newNode(-1, rootEnd);activeNode = root; //First activeNode will be rootfor (i=0; i<size; i++)extendSuffixTree(i);int labelHeight = 0;setSuffixIndexByDFS(root, labelHeight);//Free the dynamically allocated memoryfreeSuffixTreeByPostOrder(root);
}// driver program to test above functions
int main(int argc, char *argv[])
{
// strcpy(text, "xabxac#abcabxabcd$"); buildSuffixTree();strcpy(text, "xabxa#babxba$"); buildSuffixTree();return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/193013.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C 语言实现TCP 通信,以及地址复用

服务端 #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <arpa/inet.h>int main() {//监听套接字文件描述符int listenFd -1;//连接套接字的文件描述符int connFd -1;//服务器的地址结构st…

c语言-联合体和枚举

文章目录 一、联合体1. 联合体类型的声明和创建2. 联合体的特点3. 联合体大小的计算4.总结 二、枚举1. 枚举类型的声明2. 枚举类型的优点3. 枚举类型的使用 一、联合体 &#xff08;1&#xff09; 像结构体⼀样&#xff0c;联合体也是由一个或者多个成员构成&#xff0c;这些成…

GEE:使用Roberts算子卷积核进行图像卷积操作

作者:CSDN @ _养乐多_ 本文将深入探讨边缘检测中的一个经典算法,即Roberts算子卷积。我们将介绍该算法的基本原理,并演示如何在Google Earth Engine中应用Roberts算子进行图像卷积操作。并以试验区NDVI为例子,研究区真彩色影像、NDVI图像以及卷积结果如下所示, 文章目录 …

LeetCode刷题---路径问题

顾得泉&#xff1a;个人主页 个人专栏&#xff1a;《Linux操作系统》 《C/C》 《LeedCode刷题》 键盘敲烂&#xff0c;年薪百万&#xff01; 一、不同路径 题目链接&#xff1a;不同路径 题目描述 一个机器人位于一个 m x n 网格的左上角 &#xff08;起始点在下图中标记…

Python---练习:列表赋值---追加append尾部追加元素,追加的是一个元素整体

相关链接&#xff1a; Python--列表及其应用场景---增、删、改、查。-CSDN博客 代码&#xff1a; # 列表赋值 a [1, 2, 3] a.append([3, 4]) # append尾部追加元素&#xff0c;追加的是一个元素整体&#xff1a;[3, 4] print(a)

面试题:为什么 wait/notify 必须与 synchronized 一起使用??

文章目录 为什么 java wait/notify 必须与 synchronized 一起使用synchronized是什么synchronized如何实现锁wait/notify不用synchronized 会怎么样[最终形态] 把lock和obj合一lost wake up 为什么 java wait/notify 必须与 synchronized 一起使用 这个问题就是书本上没怎么讲…

理解宏任务和微任务:JavaScript 异步编程的必备知识(上)

&#x1f90d; 前端开发工程师&#xff08;主业&#xff09;、技术博主&#xff08;副业&#xff09;、已过CET6 &#x1f368; 阿珊和她的猫_CSDN个人主页 &#x1f560; 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 &#x1f35a; 蓝桥云课签约作者、已在蓝桥云…

教你5步学会用Llama2:我见过最简单的大模型教学

在这篇博客中&#xff0c;Meta 探讨了使用 Llama 2 的五个步骤&#xff0c;以便使用者在自己的项目中充分利用 Llama 2 的优势。同时详细介绍 Llama 2 的关键概念、设置方法、可用资源&#xff0c;并提供一步步设置和运行 Llama 2 的流程。 Meta 开源的 Llama 2 包括模型权重和…

Java开发项目之KTV点歌系统设计和实现

项目介绍 本系统实现KTV点歌管理的信息化&#xff0c;可以方便管理员进行更加方便快捷的管理。系统的主要使用者分为管理员和普通用户。 管理员功能模块&#xff1a; 个人中心、用户管理、歌曲库管理、歌曲类型管理、点歌信息管理。 普通用户功能模块&#xff1a; 个人中心…

一、CSharp_Basic:什么是.Net平台?什么是.Net FrameWork?什么是C#?

什么是.Net平台&#xff1f; 在了解C#之前&#xff0c;我们应该先了解一下什么是.Net平台。 .Net的诞生 2000年&#xff0c;这时候的微软凭借其Windows操作系统庞大的用户基数&#xff0c;推出了.Net1.0的标准。 也就是实现在Windows平台上面开发和应用程序的概念。我们可以简…

P3 Linux应用编程:系统调用与库函数

前言 &#x1f3ac; 个人主页&#xff1a;ChenPi &#x1f43b;推荐专栏1: 《C_ChenPi的博客-CSDN博客》✨✨✨ &#x1f525; 推荐专栏2: 《Linux C应用编程&#xff08;概念类&#xff09;_ChenPi的博客-CSDN博客》✨✨✨ &#x1f6f8;推荐专栏3: ​​​​​​《 链表_Chen…

BUUCTF [RoarCTF2019]黄金6年 1

BUUCTF:https://buuoj.cn/challenges 题目描述&#xff1a; 得到的 flag 请包上 flag{} 提交。 密文&#xff1a; 下载附件&#xff0c;得到.mp4文件。 attachment 解题思路&#xff1a; 1、浅浅的看了一遍&#xff0c;没发现什么有用的内容。放到Kinovea中&#xff0c;慢倍…

通用plantuml模板头

通用plantuml文件 startuml participant Admin order 0 #87CEFA // 参与者、顺序、颜色 participant Student order 1 #87CEFA participant Teacher order 2 #87CEFA participant TestPlayer order 3 #87CEFA participant Class order 4 #87CEFA participant Subject order …

轻量封装WebGPU渲染系统示例<42>- vsm阴影实现过程(源码)

前向实时渲染vsm阴影实现的主要步骤: 1. 编码深度数据&#xff0c;存到一个rtt中。 2. 纵向和横向执行遮挡信息blur filter sampling, 存到对应的rtt中。 3. 将上一步的结果(rtt)应用到可接收阴影的材质中。 具体代码情况文章最后附上的实现源码。 当前示例源码github地址: …

react native 环境准备

一、必备安装 1、安装node 注意 Node 的版本应大于等于 16&#xff0c;安装完 Node 后建议设置 npm 镜像&#xff08;淘宝源&#xff09;以加速后面的过程&#xff08;或使用科学上网工具&#xff09;。 node下载地址&#xff1a;Download | Node.js设置淘宝源 npm config s…

GEE:梯度卷积

作者:CSDN @ _养乐多_ 本文将介绍在 Google Earth Engine(GEE)平台上,进行梯度卷积操作的代码框架、核心函数和多种卷积核,比如 Roberts、Prewitt、Sobel、各向同性算子、Compass算子、拉普拉斯算子、不同方向线性检测算子等。 结果如下图所示, 文章目录 一、常用的梯度…

数学建模之典型相关分析

发现新天地,欢迎访问 介绍 典型相关分析&#xff08;Canonical Correlation analysis&#xff09;研究两组变量&#xff08;每组变量中都可能有多个指标&#xff09;之间相关关系的一种多元统计方法。它能够揭示出两组变量之间的内在联系。 例子 我们要探究观众和业内人士对…

非应届生简历模板13篇

无论您是职场新人还是转行求职者&#xff0c;一份出色的简历都是获得心仪岗位的关键。本文为大家精选了13篇专业的非应届生简历模板&#xff0c;无论您的经验如何&#xff0c;都可以灵活参考借鉴&#xff0c;提升自己的简历质量。让简历脱颖而出&#xff0c;轻松斩获心仪职位&a…

16.字符串处理函数——字符串长度函数

文章目录 前言一、题目描述 二、解题 程序运行代码 总结 前言 本系列为字符串处理函数编程题&#xff0c;点滴成长&#xff0c;一起逆袭。 一、题目描述 二、解题 程序运行代码 #include<stdio.h> #include<string.h> int main() {char str[ ]"0123\0456…

mac安装解压缩rar后缀文件踩坑

mac默认能够解压缩zip后缀的文件&#xff0c;如果是rar后缀的自己需要下载相关的工具解压 下载地址&#xff1a; https://www.rarlab.com/download.htm mac我是因特尔芯片所以下载 x64 然后解压缩文件进入目录 rar中 将可执行文件 rar、unrar 移动到 /usr/local/bin目录下即…