📄 judysort.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 + -