Ternary search in C

前端 未结 4 906

I want to do a ternary search for integers in C ... I have tried it...but it\'s not working well for particular cases. Please help me to remove the bugs from the following progr

4条回答
  •  生来不讨喜
    2021-01-24 03:28

    int a[30],n,i;
    scanf("%d",&n);
    for(i=0;i

    This is a typical buffer overflow issue. Allocate memory for a dynamically once you know what n is. uncleo solved your issue nicely. :)

提交回复
热议问题