⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 judysort.c

📁 一种类似于hash算法
💻 C
字号:
#include <stdio.h>#include <unistd.h>#include <string.h>#include <Judy.h>// By Doug Baskins Aug 2002 - for JudySL man pageint     // Usage:  JudySort < file_to_sortmain(){    Pvoid_t   PJArray = (PWord_t)NULL;  // Judy array.    PWord_t   PValue;                   // Judy array element.    Word_t    Bytes;                    // size of JudySL array.    char      Index[BUFSIZ];            // string to sort.    while (fgets(Index, sizeof(Index), stdin) != (char *)NULL)    {        JSLI(PValue, PJArray, Index);   // store string into array        ++(*PValue);                    // count instances of string    }    Index[0] = '\0';                    // start with smallest string.    JSLF(PValue, PJArray, Index);       // get first string    while (PValue != NULL)    {        while ((*PValue)--)             // print duplicates            printf("%s", Index);        JSLN(PValue, PJArray, Index);   // get next string    }    JSLFA(Bytes, PJArray);              // free array    fprintf(stderr, "The JudySL array used %lu bytes of memory\n", Bytes);    return (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -