Search:

Type: Posts; User: sunil9211

Search: Search took 0.00 seconds.

  1. Replies
    1
    Views
    4,772

    Kadane's algorithm for all negative number

    Can you explain Kadane's algorithm to find sub array having maximum sum value for all negative array numbers?
    For example:
    Array - [ -10, -10, -10] should return -10. But normally Kadane's...
  2. Well, i found the problem. FindMin and Findmax...

    Well, i found the problem. FindMin and Findmax functions need to return root only. No casting necessary unless you are going to print max and min values.
  3. Why does my BST program crash when I try to delete a node having grand children?

    struct node
    {
    int data;
    struct node *left, *right;
    };
    struct node *root=NULL;
    int main()
    {
    root=insert(root,100);
    insert(root,80);
  4. Replies
    1
    Views
    4,088

    Solved! I made a silly mistake. i should have...

    Solved! I made a silly mistake. i should have set the value of j as 97 not zero.
  5. Replies
    1
    Views
    4,088

    Why counter won't reset in my C program?

    Every time when the if condition is true the value of count should be printed then become zero. but that's not happening, why?
    OUTPUT:
    j=99 count=3
    j=104 count=104
    j=98 count=98. Why the...
  6. Replies
    1
    Views
    2,212

    What's wrong with this C code?

    It takes a string input then terminates.
    I can't declare initial size of string array as that depends on the user input and that can be of 10^50 size. What should i do?



    #include<stdio.h>
    int...
  7. Replies
    1
    Views
    2,394

    Which one is better, scanf or fgets

    scanf("%10[^\n]s", name) or fgets(s, 10, stdin)?
    In all possible cases when we take a string as input.
  8. It works now. I forgot that function gets() will...

    It works now. I forgot that function gets() will read only 9 char long string as its size is 10.
    Thank you everyone! :biggrin:
  9. I agree with you, but ever after initializing the...

    I agree with you, but ever after initializing the variables it's giving wrong output. Why?
  10. If we initialize c1=0, c2=0; Still the answer is...

    If we initialize c1=0, c2=0;
    Still the answer is incorrect for any string that includes one or more blank spaces.
  11. Why is this C program giving the wrong output?

    #include<string.h>
    #include<stdio.h>
    int main()
    {


    char s[10];
    fgets(s,10,stdin);
    func(s);
    return 0;
Results 1 to 11 of 13