Home > Back-end >  The algorithm Joseph, consult bosses how should solve
The algorithm Joseph, consult bosses how should solve

Time:12-02

Joseph problems learning data structure (probably means a group of people surrounded together to count off, count to three or multiples of three outs, remaining number again, know two people so far left), want to for myself, with codeblock is 17.12, the number of over 23 (23 under normal operation) when there is an error, error messages and the source code below
Problem event name: APPCRASH
Application name: TASK. Exe
Application version: 0.0.0.0
Application time stamp: 5 fc61321
Fault module name: StackHash_b59a
Failure module version: 6.1.7601.17514
Failure module timestamp: 4 ce7c8f9
Exception code: c0000374
Abnormal migration: 00000000000 c40f2
OS version: 6.1.7601.2.1.0.256.1
The locale ID: 2052
Other information: 1 b59a
Other information: 2 b59a684050b9132c40946900ac30591a
Other information 3:0 aeb
Other information 4:0 aeb7387b0545cfc2f78dd4e06b1b898

#include
#include



Typedef int EleT;

Int num=24;

Typedef struct Node
{
EleT data;

Struct Node * next;
} Node, * Clink.

Void ds_delete (pNode Clink * and an int I);
Void ds_traverse (Clink pNode);

Void Creat_ClinlList (Clink * C, EleT num)
{
Clink of p, q;
EleT I=1;
* C=(Clink) malloc (sizeof (Node));

if(!
(* C).{
The exit (1);
}

P=* C;
for(; i{
Q=(Clink) malloc (sizeof (Node));
if(! Q)
{
The exit (1);
}
Q - & gt; Data=https://bbs.csdn.net/topics/i;
P - & gt; Next=q;
p=p-> next;

}
Q - & gt; Next=(* C);

return;

}

Int Num_Clink (Clink C)
{
Clink p=C;
int i=0;
While (C!=p - & gt; Next)
{
p=p-> next;
i++;
}
return i;
}

Int main ()
{
Clink C;
int i=0;

Creat_ClinlList (& amp; C, num);
Ds_traverse (C);
Printf (" table of the elements have % d \ n \ n ", Num_Clink (C));

Clink of p, q;
P=C;
While (2 & lt; Num_Clink (C))
{
If (I % 3==2)
{
Q=p - & gt; next;
P - & gt; Next=q - & gt; next;
Free (q);
}

p=p-> next;
i++;
}
Printf (" the location of the left ");
Ds_traverse (C);

return 0;
}


p=p-> next;
i++;
}
Printf (" the location of the left ");
Ds_traverse (C);




return 0;
}

CodePudding user response:

Whole the afternoon also failed to understand, feel whole not out rice don't sweet

CodePudding user response:

reference 1st floor mll97 response:
whole also failed to understand all the afternoon, couldn't feel the whole meal all don't sweet the

List don't use one-way circular linked list with a sentry, directly with no sentries
  • Related