keyurpatel80
BAN USERRAID 0 has no mirror and no parity. This means they dont have redundancy and they can not be used for critical file systems. they have good performance. Min 2 disks required.
while RAID 10 has mirroring. that means they have redundancy and excellent performance. They are best suited for critical file system. Min 4 disks are required. They have excellent read and write performance compare to RAID 5.
You are right. Arry size should be greater than 0. I got same error on VS.
- keyurpatel80 July 05, 2014You can use DFS with backedge approach. Backedge is, you have pointer from your new node to already visited node.
- keyurpatel80 July 04, 2014This function will print each node without recursion
/* Function to traverse binary tree without recursion and
without stack */
void MorrisTraversal(struct tNode *root)
{
struct tNode *current,*pre;
if(root == NULL)
return;
current = root;
while(current != NULL)
{
if(current->left == NULL)
{
printf(" %d ", current->data);
current = current->right;
}
else
{
/* Find the inorder predecessor of current */
pre = current->left;
while(pre->right != NULL && pre->right != current)
pre = pre->right;
/* Make current as right child of its inorder predecessor */
if(pre->right == NULL)
{
pre->right = current;
current = current->left;
}
// MAGIC OF RESTORING the Tree happens here:
/* Revert the changes made in if part to restore the original
tree i.e., fix the right child of predecssor */
else
{
pre->right = NULL;
printf(" %d ",current->data);
current = current->right;
} /* End of if condition pre->right == NULL */
} /* End of if condition current->left == NULL*/
} /* End of while */
}
Here is short and sweet function
void binnum(int t)
{
unsigned int mask = 1 << (sizeof(int) * 8 - 1);
for(int i = 0; i < sizeof(int) * 8; i++)
{
if( (t & mask) == 0 )
cout << '0' ;
else
cout << '1' ;
mask >>= 1;
}
cout << endl ;
}
nice info.
- keyurpatel80 June 02, 2013can you explain your code ? It sounds like deadlock
- keyurpatel80 June 02, 2013Here is complete solution.
comment if you disagree.
//
// File: Monkey_points.cpp
//
/*******prints total number of points monkey can access ***************/
/*******print all the points monkey can access in separate points.txt file ******/
/********************************************************************************/
#include "stdafx.h"
#include <fstream>
#include <iostream>
using namespace std;
int coordinates(int x,int y)
{
int totalcount=0;
ofstream the_file;
the_file.open("points.txt");
for ( int i=(-x); i<x; i++)
{
for ( int j=(-y); j <= y; j++)
{
if ( (i + abs(j) ) <= 19)
{
cout<<i<<" "<<j<<endl;
the_file<<i<<" ";
the_file<<j<<endl;
totalcount++;
}
}
}
for ( int i=(-y); i<=y; i++)
{
for ( int j=(-x); j < y; j++)
{
if ( (i + abs(j) ) <= 19)
{
cout<<j<<" "<<i<<endl;
the_file<<j<<" ";
the_file<<i<<endl;
totalcount++;
}
}
}
the_file.close();
return totalcount;
}
int _tmain(int argc, int argv[])
{
int totalcount=0;
cout<<"Printing Monkey Access points"<<endl;
totalcount = coordinates(19,19);
cout<<"total points monkey can access is "<<totalcount<<endl;
getchar();
return 0;
}
>> Output
total points monkey can access is 2261
for me output is 1 1 1 1 1 on VS.
- keyurpatel80 May 27, 2013how can you change private memebr of class using pointer ?
- keyurpatel80 May 18, 2013free function always take pointer as argument.
Your code wont work.
if you have experience in C++, you should be able to provide syntax. Merely concept will not prove your efficiency.
- keyurpatel80 May 15, 20131. Final keyword in Java means, we can not derive any class from final class but we can certainly create object of Final class.
2. We can implement Final in C++ like below. It allows you to create object of Final class but it does not allow you to derive new class.
class Final; // The class to be made final
class MakeFinal // used to make the Final class final
{
private:
MakeFinal() { cout << "MakFinal constructor" << endl; }
friend class Final;
};
class Final : virtual MakeFinal
{
public:
Final() { cout << "Final constructor" << endl; }
};
/*class Derived : public Final // Compiler error
{
public:
Derived() { cout << "Derived constructor" << endl; }
};
*/
int main(int argc, char **argv)
{
Final obj;
}
Assuming they fix assignment operator with A& instead of void
output will be "2222"
Here is complete program and explanation.
struct A
{
int i , j;
A(int ii , int jj) :i(ii),j(ii){}
A(const A&a)
{
cout << a.i << a.j;
}
A& operator = ( A& a)
{
cout <<a.i << a.j ;
return a;
}
};
int main(int argc, char **argv)
{
A a(1,2);
A b(2,3); ==> i and j value will be 2,2
A z = (a = b); ==> Here assignment operator will be called which will print 22. Now 'a' has b's values. then it will call copy constructor to which a object is passed which has value 22 .
}
char a[] = " ";
If there is no space between quotes, then sizeof (a) is 1 byte. the reason is array store '\0' at end of every string.
e.g.
char b[] = "Keyur";
printf ("Sizeof(b) = %d\n", sizeof(b) );
it will print 6. total 5 chars from "Keyur" and '\0'
E is correct answer.
Here is complete program.
class Person{
public:
Person(const char* szName)
{
m_szName = new char();
strcpy_s(m_szName,strlen(szName)+1, szName);
}
const char* GetName() const
{
return m_szName;
}
operator const char*() const { return GetName(); };
private:
char *m_szName;
};
int main(int argc, char **argv)
{
Person person("John");
std::cout <<person;
getchar();
}
output
It will print "John"
Static scoping is scoping that is defined at compile time. This is the most commonly supported mode of scoping. Lexical scoping is a form of static scoping, where the scoping is defined by where a particular item is placed in the program source.
Dynamic scoping changes at run time. A typical form of dynamic scoping is where a caller's local variables are exposed directly to a callee. Hence, the availability of these variables is dependent on how the function is called.
In one place or many places in the application we need to be aware about a system event or an application state change. We'd like to have a standard way of subscribing to listening for system events and a standard way of notifying the interested parties. The notification should be automated after an interested party subscribed to the system event or application state change. There also should be a way to unsubscribe.
- keyurpatel80 May 12, 2013
Repleighpjoyce, job tessio at CapitalIQ
Welcome to my world.I am a safety-conscious HVAC Engineer with experience with mechanical engineering Brampton HVAC design for commercial ...
Add the least significant bytes first, keep the carry. Add the most significant bytes considering the carry from LSBs:
- keyurpatel80 July 06, 2014; x86 assembly, Intel syntax
; adds ecx:ebx to edx:eax
add eax, ebx
adc edx, ecx