Hey,
Our work on Binary Disassembly Pattern Analysis has been made a US Defensive patent publication. If you are interested, you can read more about it here: http://ip.com/IPCOM/000231860
Cheers!
Hey,
Our work on Binary Disassembly Pattern Analysis has been made a US Defensive patent publication. If you are interested, you can read more about it here: http://ip.com/IPCOM/000231860
Cheers!
Well, the logic is pretty straightforward. We start a binary search from a range of 0 to NUM, where NUM is the number whose root we are looking for. Each time, we calculate the middle item of the range and see if it is the square root. If not, we search further either in the right side or the left side of the mid item depending on whether the mid^2 is lesser or greater than NUM.
double GetRoot(double Num,double High=0, double Low=0) { if(High<Low || High-Low==1) return -1; //End case if(High==Low && Low==0) High=Num; //Start case int Mid= Low+((High-Low)/2); if(Mid*Mid==Num) return Mid; else { if(Mid*Mid>Num) return GetRoot(Num,Mid,Low); else if(Mid*Mid<Num) return GetRoot(Num,High,Mid); } }
If you have thoughts/ suggestions, post em on comments.
Well, I can’t possibly have an ‘algorithm of the day’ thread without solving the all famous N QUEENs problem.
Problem description:
Place the maximum amount of Queens on an N by N chess board and print the possible arrangements
Solution:
We will be placing 1 queen at a time per row. We would start from the left most end of the row and move 1 step to the right if there is a collision. We keep doing this till we find a spot that does poses no collisions. If there is no such spot, then one of the previous queens must be moved elsewhere.
Code:
//NQueen problem #include using namespace std; int N; int Pos=0; void NQueenDroid(int Board[100], int Remaining) { if(Remaining==0) { //found a solution cout<<endl; for(int i=0;i<N;i++) cout<<Board[i]<<" - "; Pos++; return; } int Cur= N-Remaining; //placement of current queen for(int i=0;i<N;i++) { bool IsColliding= false; for(int k=0;k<Cur;k++) { //Collision in columns if(Board[k]==i) {IsColliding=true; break;} if(abs(Board[k]-i)==abs(Cur-k)) {IsColliding=true; break;} //Collision in diagonals } if(IsColliding) continue; Board[Cur]=i; //place queen NQueenDroid(Board,Remaining-1); } } int main() { N=0; cout<<"Enter the board size :"; cin>>N; int Board[100]={0}; NQueenDroid(Board,N); //End of code return 0; }
Hi, I’m revamping my algo skills and thought of putting up the code in my blog for fun and for other’s reference. Following is the Dijkstra’s Algorithm, which is used to find the shortest path to all nodes of a graph from a single selected node.
I hit this issue when I upgraded my Hyper-V from Windows Server 2008R2 to Windows Server 2012. Some of the saved VMs were not starting up and Hyper-V failed to even enumerate the saved states of the VMs.
You can work around this issue as follows:
This fixed the issue on my setup.
DHCPerf is an open source load testing tool for DHCP-Server setups. The tool is capable of generating DHCP Client traffic with a customizable load. It comes in handy in stress testing scenarios.
I have tested it to work with Ubuntu 12.0 and Nomium’s DHCPerf 1.0.
Steps:
$sudo apt-get install alien
$sudo alien -k DHCPPerf1.0.1.0.rpm
$sudo dpkg -i DHCPPerf1.0.1.0.deb
./dhcperf –help
to see the usage of the command.
Run WireShark and set the filter to bootp to see the DHCP packets on the wire.
I recently moved to Windows 8 and one of its best features is the Hyper-V role on the client SKU. At times, when I import VHDs from my friends and try to create a snapshop, the HyperV throws an error saying “An error occurred while attempting to snapshot the selected virtual machine: Access denied”
This is because of an ACL mis-configuration and can be fixed in a jiffy.
Note: This is my quick and dirty method of fixing the issue. Not sure if it is the recommended one.
Solution:
This should resolve the security permission issue.
Round 1: Written Test
Time: 75 Minutes
Question 1:
Define a macro that takes the structure name and member name & returns the offset of the member . One must not create any instance of the struct.
Struct T
{
int a;
double b;
inc c;
}
Example:
assume int size as 4 and double as 8
OFFSET(T,a) gives 0
OFFSET(T,b) gives 4
OFFSET(T,c) gives 12
…..
Question 2:
Find the bugs in the following program which tries to delete a node from a singly linked list. Correct the bugs (logical) and optimize the program as much as possible.
struct _NODE
{
_NODE *next;
}
void deletenode(_NODE *head,_NODE n)
{
_NODE *prev,*curr;
prev=head;
curr=head;
while(curr)
{
if(curr==n)
{
delete curr;
prev->next=curr->next;
}
prev=curr;
curr=curr->next;
}
}
Question 3:
An array A contains a series of n numbers both positive and negative. Write a program to find the set of contiguous numbers that give the maximum sum. Also print the lowest and highest index of the series.
Example:
For the array: -1 -2 4 7 -3 1, the Maximal sum is 11: from 2 to 3
Question 4:
Assume a scenario where a company has several data centers at different places in India like Hyderabad Pune etc. It has its main server at some place. Now when file is requested following operation:
Example:
If the local pune server fails the main server must be able to acknowledge the failure and must be able to serve the user seamlessly without any interruptions
Question 5:
Assume that you want to port your favorite mobile application to a mobile platform. What all features would you include? Tell about the various scenarios possible and the different models that can be used. Draw a screen shot and flow diagram for all possible scenarios that you could come up with. Optimize all solutions.
Technical Interviews
The Technical interviews lasted for around 2 hours each and the questions were fired by developing on the answers of the preceding questions. I’ve pulled as much as I could from my memory.
For almost all of the questions, I was asked to write code and optimize it.
ROUND 2: INTERVIEW 1: Technical
Eg: If input A={1,2,3}, result= {(1),(2),(3),(1,2),(1,3),(2,3),(1,2,3),(NULL)}
Eg: If input = {1,2} ,{3,4} and {5,6},
Output:
{{1 3 5},{2 3 5},{1 4 5 },{2 4 5},{1 3 6},{2 3 6},{1 4 6},{2 4 6}}
Optimize the algorithm to the maximum possible extent. Prove mathematically that it is optimal.
ROUND 3: INTERVIEW 2: Technical
ROUND 4: INTERVIEW 3: Technical
Example:
ROUND 5: INTERVIEW 4: Technical
He asked me what my area of interest is, to which I replies ‘Information Security’. The following 2 hours were completely about info-security.
The Interview was an amazing experience. It was of a kind that I’ve never experienced before. The Questions were so different that we lost track of time.
Thanks for your time,
Vignesh Murugesan,Amrita School of Engineering.
My Twitter ID: http://twitter.com/vignesh_wiz
Facebook Page: http://facebook.com/vignesh.murugesan.me
I am a student of Amrita University, a peaceful university in tamil nad with an enthusiastic set of faculty members. Being an MSP, Microsoft Student Partner, I was given a shot at an interview for a Dev @ MS Hyderabad. After a written round and four successive interviews, I got a mail from Microsoft stating that they are offering me a job with a good salary package. I ve decided to take it up…