link_t *init_jos(int number) { link_t *node; int i; node = creat_linknode(&number); for(i = number - 1;i > 0;i --){ ins_head_link(node,&i); } return node->next; }
int main() { LinkNode *list = NULL; int i; int n, base; scanf("%d%d", &n, &base); list = creat_linknode(1); for(i = n; i > 1 ; i --) insert_linklist(list, i); show_linklist(list); list = joseph(list, base); show_linklist(list); free_linklist(list); return 0; }
linknode_t *creat_empty_linklist(void) { ldata_t data = {0,0}; return creat_linknode(&data); }