"If y tends to increase as x increases, then the data have a positive correlation. If y tends to decrease as x increases, then the data have a negative correlation. If the points show no correlation, then the data have approximately no correlation."
Classification of file processing by function?
Write an iterative function to search an element in a binary search tree?
_node* search (_node* head, _key key) {
_node* node;
for (node=head; node != NULL;;) {
if (key == node->key) return node;
else if (key < node.>key) node = node->left;
else node = node->right;
}
return node;
}
How do you print gantt chart for round robin in c?
#include<stdio.h>
struct RRS
{
char p[2];
int btime;
}a[5];
void main()
{
struct RRS a[5];
int i,j,n,k=0,totalbtime=0;
printf("\nEnter the no of process");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter the process name and burst time");
scanf("%s %d", a[i].p, &a[i].btime);
}
for(i=0;i<n;i++)
{
printf("\n process: %s \t btime : %d",a[i].p,a[i].btime);
totalbtime=totalbtime+a[i].btime;
}
while(k<totalbtime)
{
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
if(a[i].btime!=0)
{
printf("%s",a[i].p);
a[i].btime--;
k++;
}
}
}
}
}
output:
enter the no of process:3
enter the process name and btime:p1 4
enter the process name and btime:p2 3
enter the process name and btime:p3 1
processname btime
p1 4
p2 3
p3 1
p1p1p2p2p3p1p1p2
/*
Code by In
contact facebook.com/inderspace :)
Do whatever you like with the code.... :P
*/
#include<stdio.h>
#include<conio.h>
/*==================
*/
int main()
{
int input[20],adone[20]={0},count[20]={0};
int i,j,k,c=0;
printf("\nEnter 20 numbers followed by ',': \n");
for(i=0;i<20;i++){
scanf("%d,",&input[i]); //Here the values are input
}
for(i=0;i<20;i++){
if(!done(input[i],&adone[0])){ //checks to see if number is done before
count[c]=freq(input[i],&input[0]); //if not done that it counts frequency
adone[c]=input[i];
c++;
}
}
for(i=0;i<c;i++)
printf("\n%d = %d",adone[i],count[i]); //output in tabular fashion :)
getch(); //not supported by gcc compilers sorry :(
return 0;
}
What does non-linear data structure mean?
When we speak of linear and no-linear data structures, we are referring to the links between one element and the next. These links determine how we traverse the structure such that we "visit" every element in the structure. When every element has only one possible link to the next in sequence, then the structure is said to be linear. If any element has two or more possible links, it is said to be non-linear.
Arrays, lists, stack and queues are examples of linear structures. Trees, networks and graphs are examples of non-linear structures.
A binary tree is the simplest example of a non-linear structure because every element has, at most, two possible links, a left link and a right link. If we follow the left link, then at some point we must return to that same element in order to follow its right link. This means we must backtrack. Any structure that requires us to backtrack during a traversal is therefore non-linear.
Linear traversal is more efficient than non-linear traversal because there is no need to backtrack to traverse a linear data structure.
What is the Function of a computer in a library?
TO STORE DETAILS ABOUT THE BOKS LIKE BOOKNAME,COST,AUTHOR,PUBLISHER etc
scanf() is an input function which reads input from the standard input devices such as keyboard.
Syntax:
scanf("Control Character",address_list);
where control character is a sequence of one or more character such as %d,%f,%lf,%lld. Address list specifies the variables, pointers etc.
e.g. scanf("%d",&num);
How do you animate Tom and Jerry in C programming?
Generally you wouldn't. Tom and Jerry are owned by Time Warner and only they have the legal right to animate the characters or allow others to do so on their behalf. Even so, they wouldn't use C programming to do so, they'd use animation software, as would anyone producing animations of any kind. The software may well be written in C/C++, but this is not the same as animating in C/C++. At the core of all animation software is a 2D or 3D engine that provides the basics of animation; multi-level 2D backgrounds and foregrounds or a 3D virtual world -- the "stage" within which to animate the "actors", which are modelled separately and composited within the "stage", along with "props". The output of all animation software is a movie file (AVI, MPEG, etc) in standard or high definition, or a series of still images (BMP, etc) that can be replayed as a movie.
The expression --x is functionally equivalent to x = x - 1.
Program for inserting a new node in between two list in c?
To insert a new node between two lists, append the new node to the first list, then insert the head node of the second list after the new node.
What are the disadvantages of high level languages?
Though it is much easier to code in a high level language, oftentimes access to more low-level functionalities are lost. For instance, the ability to communicate directly with the compiler and alter code before it gets transferred into machine code is lost. An example of this is the ability to optimize code in C, whereas the Java Compiler is a different deal altogether. Other abilities may include memory management, but mainly deal with behind-the-scenes architecture-related or runtime things.
Can an identifier be used as a keyword?
As is used to import Module name as short short cut...
EX: import math as m
........Husnu
In c plus plus Programming can you replace STDio header with using name space STD?
No. You can't use namespace std even if you include stdio.h. At the very least you must include stddef.h before you can use namespace std.
How you generate power set using c program?
#include <iostream>
void printSet(int array[],int size){
int i;
for (i=1;i<=size;i++)
std::cout << array[i] << " ";
std::cout << std::endl;
return;
}
void printPowerset (int n){
int stack[10],k;
stack[0]=0; /* 0 is not considered as part of the set */
k = 0;
while(1){
if (stack[k]<n){
stack[k+1] = stack[k] + 1;
k++;
}
else{
stack[k-1]++;
k--;
}
if (k==0)
break;
printSet(stack,k);
}
return;
}
int main(){
printPowerset(4);
return 0;
}
It's the process of stepping through each node of a binary tree so that you reach each one at least once.
Binary tree traversal is special in that the output of the tree is sorted.
If you're looking for how it is done, I would highly recommend reading up on binary trees. It is easy to describe in pictures or code. I recommend against trying to get a description in text, it would only be confusing.
Write a program to find the geometric progression in c?
#include(stdio.h) // place this '<' & '>' instead of '(' & ')' before stdio.h
#include(conio.h)
#include(math.h)
int main( )
{
int x, n, sum,power;
clrscr( );
printf("Enter the values of x and n:");
scanf("%d%d", &x, &n);
if(n<0 style="font-weight: bold; color: rgb(255, 0, 0);">
{
printf("\nSorry, the formula does not make sense for negative exponents & values");
printf("Enter the values of x and n:");
scanf("%d%d", &x, &n);
sum=1;
for(power=1; power <=n; power++) {
sum=sum+ pow(x,power); }
printf("X value is: %d \nN value is: %d", x, n);
printf("\nSum of the given geometric progression: %d", sum);
}
else
{
sum=1;
for(power=1; power <=n; power++) {
sum=sum+ pow(x,power); }
printf("X value is: %d \nN value is: %d", x, n);
printf("\nSum of the given geometric progression: %d", sum);
}
getch( );
return 0;
}
Is it possible to use the bubble sort algorithm to sort strings?
Bubble sort will be able to sort the items lexicographically, if you first assign the strings a relative value. The way strcmp in the C library does this is by returning the difference of the first different characters between the strings. For instance, if you call strcmp("Hello", "Highway"), strcmp will return 'e'-'i'. The ascii value of e on a unix system is 101 and the ascii value of i is 105, so it is returning the value 101-105 = -4 which will tell you that "Hello" is lexicographically smaller than "Highway". Doing this, you should be able to use any algorithm you want to sort the strings.
How do you write a C program to check a Given Number Whether is it Palindrome or Not?
#include void main() { long int n; printf("ENTER A NUMBER: "); scanf("%ld",&n); int n1,mod; n1=n; int rev=0; while(n>0) { mod = n%10; rev = rev * 10 + mod; n = n / 10; } if (n1 == rev) printf("ENTERED NUMBER IS A PALINDROME\n"); else printf("ENTERED NUMBER NOT A PALINDROME\n"); }
How do you write a program to check the mistakes in paragraph?
This is no mean feat; actually no spell-checker / grammar-checker does a perfect job. Something simple you could do is just to check whether each word is in a dictionary. The data structures you use will depend on the programming language chosen, but having your dictionary in an array would definitely be slow - you may want to use something like a hashtable or a binary tree instead. However, an array can work for a proof of concept.
If you write your program this way, something like an "Ode to the Spelling Checker" should pass without errors - although it is full of errors. The "Ode to the Spelling Checker" uses words that are in the dictionary - but the wrong word in each case, for example "eye" instead if "I", and "tolled" instead of "told". I paste a copy of the Ode here, for your easy reference - you'll have to read it out loud to make sense out of it!
Eye halve a spelling chequer
It came with my pea sea
It plainly marques four my revue
Miss steaks eye kin knot sea.
Eye strike a quay and type a word
And weight four it two say
Weather eye am wrong oar write
It shows me strait a weigh.
As soon as a mist ache is maid
It nose bee fore two long
And eye can put the error rite
It's rare lea ever wrong.
Eye have run this poem threw it
I am shore your pleased two no
It's letter perfect awl the weigh
My chequer tolled me sew.
Its like testing a car without running it. Testing the code without actually running it.
Code reviews by peers, checklist are popular techniques.
The Dipylon Amphora painted with primitive human figures is typical of what technique in?
Red-figured
How Exampes of Accounting Rate of Return - ARR?
Year Net Income Net Cash Flow
0 0 (98500)
1 7500 24750
2 95000 31000
3 14750 34000
4 21250 40250
5 24950 44500
calculate accounting rate of return?