Finally got the correct answer!!!!! Thanks
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
Type: Posts; User: ashutosh124
Finally got the correct answer!!!!! Thanks
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
The following program throws runtime error.Please help me fix it.
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;
The expressions and their output as seen on Codeblocks 12.11 are -
int i = 1, x;
x = i++ + i++ + ++i ++i
output : x = 7 and i = 5;
But for the following -
int i = 1, x;
x = ++i ++i +...
Adak, the two algos to find the max-min that you talked about are straightforward and I know this. What I want to do is to implement the "divide and conquer approach" to it. But your such a long...
But how to increase the warning level of the compiler, presently it shows zero errors and zero warnings.
The modified code is below, which still prints the incorrect max- min.
#include<stdio.h>
#include<conio.h>
int maxmin(int,int,int *,int *);
int num[20];
main()
{
int max,min; int n,i;
the example array- 7,5,3,8
Expected output- the index of pivot element is 2 and the partitioned array is
3 5 7 8
obtained output- after entering the array, the program...
At c99tutorial,
Can you please write the modified code using both "global" and "local" scopes to better help me get the concept.
Thanks c99tutorial, to help me fix the problem in the code.
I just made a slight change- called srand(time(NULL)) before calling the rand() function and it works fine now.
But I wonder what could...
I am sorry, actually the problem is that the program does not print the repeated element. It simply stops responding, I tried it on 'codeblocks'.
I wrote a function to delete a node in the binary search tree. The code works well in case of node having no child but fails when the node has one or two child.
void deleteNode(bstree...
After replacing (a+i) with *(a+i) also the problem remains the same- the partitioned array is not printed. I think there is some run time problem which I find difficult to fix.
The problem with the code is that -line number 14 1nd 15 do not execute, that is the pivot element and the partitioned array is not printed.
Thanks for pointing the mistake.
As the variables- max and min have already been made global and the function-'maxmin' being called before the maximum and minimum values are printed, am I supposed to pass the references- &max,&min?
Given an array of size n having n/2 distinct and the rest identical elements ,write a C program to find the repeated one using randomized algorithm.
I have written the code but it has some problem...
Can anyone help me fix the problem with the code for finding max-min in an array?
#include<stdio.h>
#include<conio.h>
maxmin(int,int,int,int);
int num[20],max,min,max1,min1;
main()
{ int...
There is some problem in the following code that seeks to partition the array (the first element taken as pivot). Please help me fix the issue.
#include<stdio.h>
#include<conio.h>
int...