Posts

Showing posts from April, 2017

Important links

CPP link of Bjarne Stroustrup https://isocpp.org Design Patter http://www.bogotobogo.com/DesignPatterns/introduction.php IPC http://nptel.ac.in/courses/106108101/pdf/Lecture_Notes/Mod%207_LN.pdf

Interview questions

C++ 1. How to implement vector Answer: http://codefreakr.com/how-is-c-stl-implemented-internally/ 2. how to implement string class Answer: http://www.ccs.neu.edu/home/sbratus/com1101/mystring.txt 3. How to implement list in STL  Answer: http://codefreakr.com/how-is-c-stl-list-implemented-internally/ 4. how many casting are there in c++ & their corresponding use. Answer: http://studymustgoon.blogspot.in/2017/05/casting-in-c.html 5. what is copy constructor, write the syntex. Why we pass reference in copy constructor. 6. Is it possible virtual constructor and virtual copy constructor. 7. why virtual destructor. 8. In copy constructor can we pass pointer as an argument? Linux 1. Difference between mutex & semaphore 2. write a code for producer consumer problem. 3. in which scenario we use semaphore. C 1. how realloc is implemented.  Answer: this concept is just like malloc implementation.

Interview questions DS

Image
1. Write a program to add sum of all left most leaf node in a tree. In this example you have to add the nodes 2,5 & 4 Answer : enum direction{     left=1,     right }; int calculateleftmost(struct tree* root, direction d) {     int  ls=0, rs =0;     if(root->left == NULL && root->right == NULL)     {         if(d == left)         {             return root->data;         }     }     if(root == NULL)         return 0;     ls = calculateleftmost(tree->left, left);     lr = calculateleftmost(tree->right, right)     return ls+rs; } 2.  How to get the Kth largest number in an unsorted array Answer: soluton 1: 2...