cinderella
BAN USER
- 6of 6 votes
AnswersWhen a child is forked then it inherits parent's file descriptors, if child closes the file descriptor what will happen ? If child starts writing what shall happen to the file at the parent's end ? Who manages these inconsistencies , kernel or user ?
- cinderella in United States for 3D graphics| Report Duplicate | Flag | PURGE
Intel Software Engineer / Developer - 1of 1 vote
Answers#include <iostream>
- cinderella in United States
#include <vector>
#include <iterator>
#include <algorithm>
#include <functional>
struct base
{
int val ;
base() : val(100) {}
virtual int foo() { return val ; }
} ;
struct derived : public base
{
double val ;
derived() : val(200.2) {}
virtual int foo() { return val ; }
} ;
int main()
{
std::vector<base*> vec( 3 ) ;
derived derived ;
std::fill( vec.begin(), vec.end(), &derived ) ;
std::transform( vec.begin(), vec.end(),
std::ostream_iterator<int>( std::cout, "+" ),
std::mem_fun( &base::foo ) ) ;
return 0;
}
what will be the output of the code above| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersGiven a binary search tree. Find the maximum depth of the binary search tree iteratively.
- cinderella in United States for Windows Live| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersAlgorithm to find the square root of a given number in C without using sqrt
- cinderella in United States for cloud| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer - 0of 0 votes
Answersgiven the following inheritance scheme
- cinderella in United States
class A
{
}
class B : public A
{
}
class C : public A
{
}
class D : public C
{
}
Given a function
static void foo(C * obj)
{
}
which one of the above defined classes' pointer can be passed into the function foo()| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C++ - 0of 0 votes
AnswersGiven an array a int[5], there are 3 nos which are same and 2 numbers which are same. Write a function which should return true or false if the array is this way.
- cinderella in United States for Market data
for eg . 4,4,4, 5,5
function should return true in the above case.| Report Duplicate | Flag | PURGE
FactSet Research Systems, Inc Software Engineer / Developer - 0of 0 votes
AnswersGiven a shuffle of cards what data structure would you use ? Also tell how would you carry out the suffle operation on that deck such that it is ensured that each card gets shuffled.
- cinderella| Report Duplicate | Flag | PURGE
National Instruments Software Engineer / Developer Algorithm Data Structures - 0of 0 votes
AnswersGiven a shuffle of cards what data structure would you use ? Also tell how would you carry out the suffle operation on that deck such that it is ensured that each card gets shuffled.
- cinderella| Report Duplicate | Flag | PURGE
National Instruments Software Engineer / Developer Algorithm
May be reverse the string from the position of swap till the last and concatenate with the rest of the number.
7864(reverse 64 => 46) so 7846
76843
78643(reverse 643 => 346)
78346
7558
7855 ( reverse 55 => 55)
796851
798651( reverse 651 => 156)
798156
this reverse might work because while traversing from right to left we have made sure that it is sorted.
Is there a better way ?
how about
1. start from the right most digit ( ones position)
2. check if it is bigger than the immediate left..(tens position)
if yes then
swap them you got the answer
else
check the next left ( hundered postion)
if 10s is bigger than the 100s swap then you got the answer
This might give the right answer because if 1s position is bigger than the 10s then swaping them would give the immediate next bigger number and if it is not then this method will make sure it is smaller than all the subsequent digits traversing from left to right.
eg. 79 ( swap 1s position and 10s)
ans 97
eg 7585
1s(5) < 10s(8) hence do not swap
10s(8)> 100s(5) hence swap
ans 7855
eg. 7439
swap (9,3) ans 7493 ( next bigger no)
Please tell me any counter example in which case it will not work .
1. if you xor all the numbers then the no which occurs 3 times can be obtained, now an efficient way needs to be found out for finding the 2nd no.
2. when you get the odd no of times occurring element then again XOR each element with this element , there should be 3 zeros now and two similar nos.
0,0,0, 001, 001 ( 4^5 = 001)
3. Now again XOR all the elements with each other if the result == 0 (001^001 == 0) then return true
But this approach requires 3 passes so not an efficient one.
If anyone can suggest a better solution
the numbers can be in any positions, the array is not sorted.
- cinderella September 13, 2011Auto variables are not stored in heap because heap is for dynamic memory allocation, it is like an unorganised bunch of memory from which u can allocate any size of mememory. An auto variable is allocated memory before only so it is allocated systematically on the stack.
- cinderella September 19, 2010
RepArnavPatel, abc at A9
Dedicated and energetic bakery assistant with a passion for flavor and a love for creating. Professional and dependable with more ...
RepColaraJoshi, Floor manager at Thomes
By profession, I am Floor manager in the Thomes store. I am passionate about astrology and read tronto cards, horoscopes ...
RepFreyaShaw, Attorney at 247quickbookshelp
Excellent verbal and written communication skills to aid in properly presenting positions, arguing cases, and getting positive outcomes for clients ...
Repnovathomes, abc at 8x8
I am a friendly and outgoing person who enjoys greeting people with a smile. I have more than eight years ...
Reptanyaarriol911, Applications Developer at ABC TECH SUPPORT
I am working as a Data entry Manager and I love my job. Also I love to read new Articles ...
RepAdaShipman, abc at 247quickbookshelp
During operation, determine all necessary adjustments to the printing press to maintain safety, quality and productivity standards and make such ...
Repmandybourne5463, Accountant at ABC TECH SUPPORT
MandyBourne, and I am a Computer typesetter and I love my work. Apart from this, today I am doing new ...
RepGigiTaylor, abc at 8x8
Dedicated English Mandarin Chinese translator with years of experience working in professional and scientific communities.Voracious reader and participant in ...
RepSusanKater, Animator at CDAC-ACTS
Susan , a highly experienced Sportscaster , Utilizes excellent communication skills and revolves local stories into feature stories, also delivered sportscasts in ...
Repzk6354367, Financial Software Developer at Agilent Technologies
Hi , I am Zessie from the USA , working as Dien for the last three years. Previously I have served as ...
RepLisaNoto, Android Engineer at ADP
Annie has nearly 10 years of experience working on anadromous and estuarine fishery issues in California. She serves as a ...
Replevijhoyt, Android Engineer at A9
Hello, I am working as a machine operator and we are working in manufacturing units and operate equipment to create ...
Repdubinalinda4, Animator at Apache Design
Hello, I am a school librarian from Lewistown USA. I work in public or private schools at elementary, middle and ...
RepSamiyahKate, Java Experienced at Agilent Technologies
I am Samiyah, having 3 years of experience in assessing, diagnosing, screening, and preventing language, speech, and swallowing disorders. I ...
RepMillaSoth, Intern at ADP
I am Milla , a dedicated Emergency Response Technician regarded for performing advanced medical procedures with a high degree of accuracy ...
Repaleasebkern, Personnel
Plant operators manage all things in an industrial plant or a power plant . They are supervising all the work . For ...
RepGizzyKale, Graphics Programmer at Arista Networks
Je suis Gizzy, un commis aux archives avec d'excellentes compétences interpersonnelles et de communication. Expert en nourriture , boisson et ...
Replushililly, Area Sales Manager at ASAPInfosystemsPvtLtd
I am Graphic designer from Watertown. a professional within the graphic design and graphic arts industry assembles together images, typography ...
RepNirvedDavis, abc at 8x8
Professional lifeguard offering expertise in water safety. Worked for more than six years in guarding and controlling the safety of ...
RepPamPucker, HR Executive at Adap.tv
I am Pam from Birmingham USA, A Secretary serves as a trusted personal assistant . My interest in ice skating, and ...
Repnp810929, Product Security Engineer at Absolute Softech Ltd
I am Neesha , a Creative news writer with 3+ years of experience at Audio Visions. Great storytelling skills and a ...
Rephugaliuli, Nurse at 8x8
Registered nurse with experience in delivering quality care to patients. Professional with more than 3 years in emergency room care ...
Repangilafinch, Applications Developer at Aristocrat Gaming
I am Angila, expert system operator in Linens'n from 2017, Where I interact with network providers and perform troubleshooting ...
RepMiaMiller, abc at A9
Experienced software engineer with a passion for developing innovative programs that expedite the efficiency and effectiveness of organizational success. Well-versed ...
Repkany7635, optician at AMMB
I am a detail oriented and knowledgeable optical assistant with 2 years of experience in an optometry office setting. Collect ...
Repcorinnedonon, Backend Developer at A9
I am Corinne, a highly organised, professional and self-motivated Dietitian with a great passion for nutrition and people’s well-being ...
Repwastonlare, Java Developer at Broadsoft
Waston , an executive in the finance and accounting area of the industry with expertise in teaching, training and managing my ...
Repaaronyocoma, U.S. marshal at Pacific Stereo
Working as U.S. marshal at Pacific Stereo numerous years . I encountered heaps of things . With this I likewise like ...
RepEshikaLopez, general assistant at MMSS
Dedicated and reliable general assistant with background in and strong knowledge of secretarial and administrative principles. Capable of providing direct ...
RepNoraMiller, abc at A9
Confident and dedicated photographer with experience in both professional and freelance photography.. Prioritizes communication on the job to avoid errors ...
Repzippy28943, Data Scientist at AppNexus
Maxine , a grant writer specializing in researching and analysing grant opportunities, creating funding plans, and conducting proposals and budgets. Last ...
int Height(Tree t) {
- cinderella October 29, 2011int height = -1;
if(t != NULL) {
std::list<Tree> q; //Queue to store tree nodes
q.push_back(t);
q.push_back(NULL); //null is the delimeter to show end of the level
while(!q.empty()) {
TreeNode *node = q.front();
q.pop_front();
if(node == NULL) {//delimeter encountered, increase height and push NULL if q not empty
height++;
if(!q.empty())
q.push_back(NULL);
}
else {
if(node->left)
q.push_back(node->left);
if(node->right)
q.push_back(node->right);
}
}
}
return height;
}