Learn Android: http://learnandroideasily.blogspot.in/
BAN USER- 0of 0 votes
AnswersFind the element that appears once
- Learn Android: http://learnandroideasily.blogspot.in/ in India
Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once.
Expected time complexity is O(n) and O(1) extra space.
Examples:
Input: arr[] = {12, 1, 12, 3, 12, 1, 1, 2, 3, 3}
Output: 2| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite a code that will check whether the memory allotted to the program at the initial and the memory returned to the system is same or not.
- Learn Android: http://learnandroideasily.blogspot.in/ in India| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer C - 0of 0 votes
Answersfind the number of integral solution of
- Learn Android: http://learnandroideasily.blogspot.in/ in India
1/x+1/y=1/n!| Report Duplicate | Flag | PURGE
- 0of 0 votes
Answer#include <cstdlib> #include <iostream> using namespace std; class Empty {}; class Derived1 : public Empty {}; class Derived2 : virtual public Empty {}; class Derived3 : public Empty { char c; }; class Derived4 : virtual public Empty { char c; }; class Dummy { char c; }; int main(int argc, char *argv[]) { cout << "sizeof(Empty) " << sizeof(Empty) << endl; cout << "sizeof(Derived1) " << sizeof(Derived1) << endl; cout << "sizeof(Derived2) " << sizeof(Derived2) << endl; cout << "sizeof(Derived3) " << sizeof(Derived3) << endl; cout << "sizeof(Derived4) " << sizeof(Derived4) << endl; cout << "sizeof(Dummy) " << sizeof(Dummy) << endl; system("PAUSE"); return EXIT_SUCCESS; }
and the out put is (In Dev c++)
- Learn Android: http://learnandroideasily.blogspot.in/ in India
sizeof(Empty) 1
sizeof(Derived1) 1
sizeof(Derived2) 4
sizeof(Derived3) 1
sizeof(Derived4) 8
sizeof(Dummy) 1
why the size of derived2 is 4 and the size of derived 4 is 8.| Report Duplicate | Flag | PURGE
- 0of 0 votes
AnswersGiven N points(in 2D) with x and y coordinates. You have to find a point P (in N given points) such that the sum of distances from other(N-1) points to P is minimum.
- Learn Android: http://learnandroideasily.blogspot.in/ in India| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Algorithm - 0of 0 votes
Answersthere are two processes p1 & p2
- Learn Android: http://learnandroideasily.blogspot.in/ in India
P1 : read the file
P2 : modify the file
how will u synchronize the process so that modify can happen only when no one is reading the file. Using constructs
Enter Critical Section :
Exit Critical Section :
Wait Event :
Signal Event| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer - 0of 0 votes
AnswersDetermine if the given string is of form pZq.
- Learn Android: http://learnandroideasily.blogspot.in/ in India
q consist the reverse of p.
and p and q will consist only X and Y.
for ex. p=XYXX and q=XXYX(reverse of p). then
string XYXXABXXYX is a valid string.
The constraint is : you can access only next character at each point.| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer
bestinterviewsquestions.blogspot.in/2013/02/print-all-combination-of-given-length-k.html
- Learn Android: http://learnandroideasily.blogspot.in/ February 06, 2013See The Link bestinterviewsquestions.blogspot.in/2013/01/convert-string-to-integer-implement-atoi.html
The code may give segmentation fault or linking error.
int array[10]; tells that array is an array of 10 integers.
extern int*myarray; tells that myarray is a pointer to an integer which in defined at some other, place probably in some other .c file. But it is not defined any where(even not initiallised).
so we must generate all the subsets of of size s and check that sum in N ?
- Learn Android: http://learnandroideasily.blogspot.in/ May 09, 2012probability will be 8/9<=p<=1
- Learn Android: http://learnandroideasily.blogspot.in/ May 08, 2012#include <cstdlib>
#include <iostream>
using namespace std;
void fun(int n)
{
if(n==1)
return;
if(n%2==0)
{
fun(n/2);
cout<<" "<<n/2;
}
else
{
fun(n/2);
cout<<" "<<(n/2)+1<<" "<<n/2;
}
}
int main(int argc, char *argv[])
{
int n=2355;
fun(n);
cout<<" "<<n;
system("PAUSE");
return EXIT_SUCCESS;
}
In java operator overloading is not supported
- Learn Android: http://learnandroideasily.blogspot.in/ March 08, 2012int maxLoss(int a[],int n)
{
int max=a[0],maxloss=0;
for(int i=1;i<n;i++)
{
if(maxloss<max-a[i])
maxloss=max-a[i];
if(max<a[i])
max=a[i];
}
return maxloss;
}
- Learn Android: http://learnandroideasily.blogspot.in/ October 18, 2011what something like this
int main()
{
char a;
int n;
if(n=((char*)(&a+1)-(char*)&a))
if(n==4)
printf("it is integer");
else if(n==1)
printf("it is char");
// and so on
return 0;
}
its working dear
we can use function template
template <class t>
void swap(t a,t b)
{
t temp=a;
a=b;
b=temp;
}
(int)(float)(char) i1;
this statement does modify the data type of i1 . i1 is still double that is why it size is 8
i agree with you
in the diven options unly destructers cant be overloaded
sorry 10000 size
- Learn Android: http://learnandroideasily.blogspot.in/ June 15, 2011@to the people suggesting for hash table
range is not given how much big table will u take
foe eg list conatains
1 2 3 4 2 5 6 5 7 8 10000 u will need an array of 1000 size
for(;0;)
printf("\n guess");
Output:
No errors or program output.
and please dont joke this cant be amazom question
how to know how much memory should be allocated for string.
- Learn Android: http://learnandroideasily.blogspot.in/ June 15, 2011are u here to do jokes
- Learn Android: http://learnandroideasily.blogspot.in/ June 15, 2011i also agree with the solution. file siaze totally depends on file system.
in unix inode contanis a fild fileSize of 32 bit it limits file size to 4 gb.
http://bestinterviewsquestions.blogspot.in/2013/02/find-least-common-ancestorlca.html
- Learn Android: http://learnandroideasily.blogspot.in/ February 06, 2013