temp=pivot;
pivot=a[j];
a[j]=temp;
if changed to
temp=a[low];
a[low]=a[j];
Type: Posts; User: ramayana
temp=pivot;
pivot=a[j];
a[j]=temp;
if changed to
temp=a[low];
a[low]=a[j];
Sorry for the indentation this is the best I could manage , about the main() this is the way I do and I don't think it comes in the way of the program . I have tried tracing the program but the...
This program is supposed to impelement quicksort but it is not working
include<stdio.h>
#include<conio.h>
#include<process.h>
void quicksort(int a[] ,int low,int high);
int partition(int...
ok , if that happens "c" and "d" won't be executed as the block following if will be skipped.
Given below is a function which is part of a bigger program implementing Merge Sort http://linux.wku.edu/~lamonml/algor/sort/merge.html
void merge_sort(int a[], int low , int high) //a
{
...
Can it be because I'm using float and not double and beacuse the time elapsed is small enough that it doesnt fit onto the float format?
I'm supposed to do a sequential earch on integers and also retun the time elapsed on doing such a search . Here is what I have.
#include<stdio.h>
#include<conio.h>
#include<time.h>
void...
An integer(default in type) type occupies the whole word length of a computer as it's storage . Hence , for a 16 bit computer(my case) one integer occupies 16 bits or convinently 2 bytes. For an...
ANSI C - E . Balagurusumy
This is the best C primer book especially if you get hold of the latest edition. Especially good for learning the basics of the language as all possible syntax of any new...
Yes there is ...we are required to implement queues using array here ...I know this would increase the code length as using link list to implement the same problem is rather easy ....but this is the...
ok will keep it in mind, still the problem though remains unresolved
Sorry but this is the smallest main function I could manage...May be it can be further decomposed into smaller functions but being an absolute rookie in C (my experience with C is as of today 15 days...
Hello , I'm suppposed to make three queues and then insert,delete and display items in them according to a given priority
So, if the user enters priority as 1/2/3 then I'm supposed to...
Oh thanks now i understand
M friend got my code corrected, there are two changes that he made....
fprintf(fp,"%d %s %d %d %d ",st.usn,st.name,st.marks1,st.marks2,st.marks3);
/* blank space between the control strings*/...
As i said I've reformatted my code ...the code I've used before was wrong i know it ...I'd posted above the correct code after your advice
void display(FILE*fp)
{
STD st;/*declares...
My apologies ....when I said I'm posting the "reformed" code i"d posted infact a code that was still half done ......
This is the code which I'd written after the advice .....
/* DS lab...
Thanks a lot ....sorry for the crappy code but the text editor I use
is crappy itself and this is the best I could managae.
My compiler would issue a "function should return value" if i use int...
Thanks a lot .... But I'm still having problem with my program..With your advice i have reformed my code as follows
/* DS lab program 1*/
#include<stdio.h>
#include<conio.h>...
As part of my Data Structures lab I'm required to write a program
to create a sequential file to store the following
USN(integer type) ,Name, Marks1 ,Marks2 ,Marks3
Then search using the USN for...
I'm having problem understanding the concepts of ftell(),fseek etc.
i need to know
a)the general syntax of ftell() is ....n=ftell(file_pointer);
supppose for a file to which i have already...
heh ok
But 'sum' I thought is of type float and the whole expression is
real expression and hence the right hand side of the assignment operator sum=sum+(1/deno) should be of type float ,isnt it ?
I"m beginning to learn C .The book I follow tells that when any variable has been declared as type int , in 32 bit computer the maximum integer that can be stored is 2147483647 while on 16
bit it is...
I have tried to code the following harmonic series as below but the progrma outputs 1.000000 only, could someone point out where the flaw is ?
1+1/2+1/3+...........+1/n
#include<stdio.h>...