Write a c program to convert from cartesian to polar coordinates?
the equation that convert from cartesian to polar coordinates and vice versa
r = sqrt (x*x+y*y);
phi = atan2 (y, x);
x = r*cos (phi);
y = r*sin (phi);
What is faster access the element in an array or in a list?
Array is always faster to read from disk/access any element in the array is quicker since elements in a array are stored in contiguous location in the memory, you need the pointer to the head or 0th element in the array and then it much quick to navigate to the next on index based. But you need to know INDEX of the element for best results
List (say linked list) will be slower since not always elements are stored in contiguous location in the memory as well it involves a function call which is can be assembler/cpu expensive.
However getting an individual object from an array is faster if you know the index of the object. Walking through a linked list is faster than walking through an array, if you use a non-recursive algorithm.
--Vinay Solanki
What are the Differences between array and queue?
from the abstraction: list
you go to the implementation details (concrete):
arraylist,vector or linkedlist,circularlinkedlist and maybe more
when somebody asks you for a special list in this case (queue)
speciality 1 enqueue -add to botton
speciality 2 dequeue - remove from top
you are free to pick up arraylist,and/or linkedlist and/or circularlists and/or vector to implement your new specialized list called queue.
and/or means you might want to combine as well
What is the function of radioisotopes C-14?
Used in carbon dating that is to find the age of fossils.
Far pointer size in C plus plus?
If you are talking "far pointer", then you are probably talking about real mode in a 16 bit environment such as DOS or Windows 3.1, or in Virtual 8086 mode in Windows 95 or higher. In this mode, addressing is segmented into 65536 segments of 65536 bytes each, but each segment overlaps the next by only a 16 byte offset. This gives you addressability to 1048576 bytes. A far pointer is a 32 bit object, containing a 16 bit segment and a 16 bit offset. int __far *p; /* a far pointer called p which points to an int */
No such predefined type, so you can define it as you wish.
What does cout stand for in c?
It serves to send usually text-based information on the monitor (in currently running application, window), for instance:
...
int myVariable;
cout >> "Please enter a number: ";
cin >> myVarible;
//You entered number 5
cout << "You entered the number: " << myVariable;
...
In the application window you will see:
Please enter a number:
5
You entered the number: 5
Write a program to add two numbers using oop?
#include<iostream.h>
#include<conio.h>
void main()
{
int a, b, c;
clrscr();
cout<<"enter the two numbers";
cin>>a;
cin>b;
c=a+b;
cout<<"Addition of two numbers="<<c;
getch();
}
Data structure is a very basic concept.
I don't think it's possible to trace it back to a single person who invented it...
Difference between Data Type and Abstract Data Type?
A data type tends to mean a primitive data type. Primitive data are built-in data types, such as integers, characters and Booleans. They are basic constructs of the language (that is, they are built into the language).
Primitive data also tends to be of a strict data type, meaning you can't treat characters like integers or Booleans like integers, etc., although some languages will support implicit casting of primitive data types (for example, will treat Booleans like integers if you use a Boolean in an arithmetic operation).
Abstract data types are generally constructed by the user or by a higher level language. For example, you might create a currency data type, which generally acts like a float but always has a precision of 2 decimal places and implements special rules about how to round off fractions of a cent.
Abstract data types also often contain the ability to either be treated as a specific type of primitive data in certain circumstances (for example, many languages allow you to treat strings as character arrays); or contain certain rules / methods to manipulate their data (such as a programming language allowing you to cast a float as an integer).
A data structure is a gathering together of many different data types. For example, objects and arrays are data structures. Data structures usually can contain information of many different types (such as strings, integers, Booleans) at the same time, and in more complex structures -- namely, classes -- can contain specific methods, properties and events to manipulate that data, change its type, etc.
What is Difference between one dimensional array and two dimensional?
A matrix (two dimensional array) is a group of lists, or arrays that are organized into one data set. To understand them, first look an example of the standard one dimensional array:
Array "A":
16
8
99
0
5
You can reference any point in the "array" by naming the array and following it with a number representing the position of a piece of data on the list. The first data on the array is represented with a "0", the second with a "1", and so on. For example, A[2] (in bold) represents 99 because it is the third figure of array A. You could imagine the references of the above table as the following:
Array "A":
[0]
[1]
[2]
[3]
[4]
A matrix is a set of arrays. Visualize the following table:
Matrix "B":
16 17 9
8 88 74
99 12 21
0 6 40
5 19 18
There are 3 different arrays in a single data set, "B". In Array A, you could reference any data by naming the point on the list, such as "1" or "3". However, with a matrix, you must give both a row and a column. You can reference data on a matrix in the following format:
MatrixName[row][column]
For example, B[3][2] would represent 40 because it is the it is on the fourth row down and the third column. Remember, matrix references also start at zero, not one! You can reference any of the data on this table with this chart:
Matrix "B":
[0][0] [0][1] [0][2]
[1][0] [1][1] [1][2]
[2][0] [2][1] [2][2]
[3][0] [3][1] [3][2]
[4][0] [4][1] [4][2]
Two-dimensional arrays are used everywhere, but are especially prevalent in computer programming and accounting. If you know any programmers, ask them the last time the last time they used a matrix- I'm sure they'll give you plenty of examples!
How do you make an array of 56?
In Java:
int[] myArray;
// or: int myArray[]
followed by:
myArray = new int[16];
Instead of int, you can use any other data type, including a class.
C program for polynomial addition?
POLYNOMIAL ADDITION
#include
#include
typedef struct poly
{
int coeff;
int expo;
}p;
p p1[10],p2[10],p3[10];
void main()
{
int t1,t2,t3,k;
int read(p p1[10]);
int add(p p1[10],p p2[10],int t1,int t2,p p3[10]);
void print(p p2[10],int t2);
void printo(p pp[10],int t2);
clrscr();
t1=read(p1);
print(p1,t1);
t2=read(p2);
print(p2,t2);
t3=add(p1,p2,t1,t2,p3);
printo(p3,t3);
getch();
}
int read(p p[10])
{
int t1,i;
printf("\n Enter the total no of terms");
scanf("%d",&t1);
printf("\n Enter the coeff and expo in descending order");
for(i=0;i scanf("%d%d",&p[i].coeff,&p[i].expo); return(t1); } int add(p p1[10],p p2[10],int t1,int t2,p p3[10]) { int i,j,k; int t3; i=0,j=0,k=0; while(i { if(p1[i].expo==p2[j].expo) { p3[k].coeff=p1[i].coeff+p2[j].coeff; p3[k].expo=p1[i].expo; i++;j++;k++; } else if(p1[1].expo>p2[j].expo) { p3[k].coeff=p1[i].coeff; p3[k].expo=p1[i].expo; i++;k++; } else { p3[k].coeff=p2[j].coeff; p3[k].expo=p2[j].expo; j++;k++; } } while(i { p3[k].coeff=p1[i].coeff; p3[k].expo=p1[i].expo; i++;k++; } while(j { p3[k].coeff=p2[j].coeff; p3[k].expo=p2[j].expo; j++;k++; } t3=k; return(t3); } void print(p pp[10],int term) { int k; printf("\n\n Given Polynomial:"); for(k=0;k printf("%dx^%d+",pp[k].coeff,pp[k].expo); printf("%dx^%d",pp[k].coeff,pp[k].expo); } void printo(p pp[10],int term) { int k; printf("\n\n The addition of polynomial:"); for(k=0;k printf("%dx^%d+",pp[k].coeff,pp[k].expo); printf("%dx^%d",pp[k].coeff,pp[k].expo); }
What does the C language have to do with the success of Linux?
Very little. C is a very common language to write operating systems in.
What is the c program for character stuffing and destuffing?
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
char a[20],b[50],c[50],ch;
int i=0,n;
void sender();
void receiver();
void main()
{
clrscr();
sender();
receiver();
getch();
}
void sender()
{
int j=0,pos;
printf("\n\n Sender side \n\n");
printf("Enter string : ");
scanf("%s",&a);
n=strlen(a);
printf("\n Enter position : ");
scanf("%d",&pos);
label: if(pos>n)
{
printf("\n Invalid position, Enter again : ");
scanf("%d",&pos);
goto label;
}
printf("\n Enter the character : ");
ch=getche();
b[0]='d';
b[1]='l';
b[2]='e';
b[3]='s';
b[4]='t';
b[5]='x';
j=6;
while(i<n)
{
if(i==pos-1)
{
b[j]='d';
b[j+1]='l';
b[j+2]='e';
b[j+3]=ch;
b[j+4]='d';
b[j+5]='l';
b[j+6]='e';
j=j+7;
}
if(a[i]=='d' && a[i+1]=='l' && a[i+2]=='e')
{
b[j]='d';
b[j+1]='l';
b[j+2]='e';
j=j+3;
}
b[j]=a[i];
i++;
j++;
}
b[j]='d';
b[j+1]='l';
b[j+2]='e';
b[j+3]='e';
b[j+4]='t';
b[j+5]='x';
b[j+6]='\0';
printf("\nframe after stuffing : %s" ,b);
}
void receiver()
{
int j=6;
printf("\n\n\n\n Receiver side\n\n");
printf("\nThe data came from sender side is : %s",b);
n=strlen(b);
while(j<n-6)
{
if(b[j]=='d' && b[j+1]=='l' && b[j+2]=='e')
{
if(b[j+3]=='d' && b[j+4]=='l' && b[j+5]=='e')
{
c[i]=b[j+3];
c[i+1]=b[j+4];
c[i+2]=b[j+5];
i = i+3;
j = j+6;
}
else if(b[j+4]=='d' && b[j+5]=='l' && b[j+6]=='e')
{
j = j+7;
}
}
else
{
c[i]=b[j];
i++;
j++;
}
}
printf("\n\nOriginal data : %s",c);
}
That depends on who you ask and how far back you go. It could be Intel, it could be whoever designed the ENAIC (used for looking up trajectory tables) but I think it was Charles Babbage, inventor of the 'analytical machine.'
More:
http://en.wikipedia.org/wiki/Turing_complete
Write a program to accept a character value from the user and sHow is its ASCII value?
You don't need to write a program to do this. Each character (char) is actually an int. If you want to see the ASCII value of a char you can simply:
char c = 'a';
System.out.print( (int)c );
Differences between b tree and b tree?
Answer:
Binary tree is a tree data structure in which each node has at most two children. Typically the first node is known as the parent and the child nodes are called left and right.
A B-tree is a tree data structure that keeps data sorted and allows searches, insertions, deletions, and sequential access in logarithmic amortized time. The B-tree is a generalization of a binary search tree in that more than two paths diverge from a single node. Unlike self-balancing binary search trees, the B-tree is optimized for systems that read and write large blocks of data. It is most commonly used in databases and filesystems.
Which sorting method has best perfomance in terms of storage and time complexity?
Quicksort will usually be the best performing sort. However, quicksort has a worst-case time complexity of O(n2), which may not be reasonable in a real world application. Heapsort is often used in place of quicksort in these cases, as it has a worst-case of O(n log n).
The last of the "big three" sorts is mergesort, which excels in a few areas. Mergesort is trivially easy to parallelize, which is increasingly useful as multi-CPU machines become more and more common. Mergesort is also a stable sort, which may or may not be useful for a given application.
What is a c program to reverse a five digit number?
#include <stdio.h>
int main(void){
// Local Declerations
int intNum;
int midDigit;
// Statements
printf("Enter a 5 digit integral number: ");
scanf("%d", &intNum);
//the assignment expression below is used to calculate the mid digit
oneDigit = (intNum % 1000) / 100;
printf("\nThe middle digit is: %d", oneDigit);
return 0;
}
C plus plus program to find factorial of given number using function overloading?
Use this function: long factorial(int N)
{
if (N == 0)
{
return 1;
}
else
{
return N*factorial(N-1);
}
}
What are the three types of master data discussed in this exercise?
The three types of master data discussed are reference data and enterprise data. Lastly, there is also market master data.
scanf: scanf is a built-in function to read input from the user.