## abhimanipal

BAN USERI am currently doing my Masters in Computer Science at SUNY- Buffalo. I have gpa of 3.68. Most of my development experience is in C/C++.

Check out my resume for more details on my research/ projects

Abhishek Agrawal

77, Merrimac Street,

Buffalo, NY 14221

aa225@buffalo.edu

(716) 435-7122

OBJECTIVE

Seeking a position in an organization that would allow me to utilize my skills to the maximum.

EDUCATION

University at Buffalo, The State University of New York Masters of Science, Computer Science and Engineering • Current CGPA 3.68/4.0

RESEARCH EXPERIENCE

Modified Priority Scheduler for Improved Performance NSF Funded

• We attempt to improve upon the resource utilization for clusters by designing better scheduling algorithms. The parameter we wish to optimize is the slowdown experienced by each job. • Made my own job simulator to compare my scheduling algorithm with the competition. The workload was taken from the parallel workloads archive. Code was written in Java. .

• Presented a research poster on this topic in IEEE Cluster 2009 conference.

Efficient Traversal of an Area using Wireless Sensor Nodes Masters Project

• Area traversal/ coverage is a fundamental application for Wireless Sensor Nodes. We developed 2 new algorithms in this area. • The first algorithm ensured quick coverage of the area and at a reasonable energy cost. The second algorithm covered the area efficiently even if there were holes in it, which was impossible previously.

• Language used was C. Got full credit for this project

SKILLS Programming Languages: C/ C++, Java

Parallel Programming/ Multi threaded programming Hadoop File System, HBase, Hive, Hama

Network Simulators: Glomosim, NS2 Other Technologies: Perl, Tcl, SQl, Microsoft Office Products Internet Technologies: HTML,JSP,ASP Operating Systems: Windows XP, Vista, FreeBSD, Unix, Linux

PROJECTS

A Compiler for C++ Language

• Implemented a compiler, which could compile instructions like data declaration, if else, for/ while loops in C++

• Language used was C++. Operating System was Windows. Secured an A for this project.

Created Containers for exchange of data between processes • A scheme for the processes in the kernel to exchange data. 5 system calls added to the kernel to facilitate this.

• Extensive usage of data structure locking, dynamic memory usage, sleep/wake mechanism in the kernel.

• Language used in C. Operating system used is FreeBSD. Secured full credit for this project.

File System using Inet Domain Sockets

• Designed a distributed file system using Inet Domain Sockets. The file system was capable of performing basic operations like File Create, File Read, File Write, File Append, File List, etc. Storage of files was persistent. • Language used was C. Operating System was Linux. Secured full credit for this project.

RCP- A new Transport Layer Protocol for TCP/IP stack

• RCP is a clone of TCP- Tahoe but the congestion control is completely handled by the receiver. Implement this protocol and compared its performance with TCP- Tahoe.

• Implementation was in NS2. Languages used were C++, Tcl. Operating System was Solaris.

Implementation of Markowitz model using Hadoop

• Simulating the Markowitz model on Hadoop. The co variance matrix and expected returns matrix is computed in parallel. Currently trying to simulate SVD decomposition on Hadoop to calculate the inverse of a matrix. Will compare the performance with traditional databases.

• Hadoop/HBase is used for data storage. Used Hama for matrix multiplication. Code was written in Java.

Mac Layer Protocol for TCP/IP stack

• Developed a MAC layer protocol for an ad hoc network. There are 99 senders and each sends b copies of data in every time unit. Receiver cannot sense the medium. The value of b which maximizes data transfer is found.

• Implementation was in Glomosim. Language used was C. Operating System was Solaris.

Portable Indoor Air Quality Sensor for Asthma Patients • Designed a sensor for use by Asthma patients. The sensor warned the patient if the air in the room could trigger an asthma attack. The sensor could be calibrated according to the needs of the individual. • Wrote the system specification document, the SRS document, the project plan, designed test cases for this

project.

ACHIEVEMENTS

• NSF grant for conducting research on scheduling in Clusters.

• Active contributor on DaniWeb C and C++ communities. username- abhimanipal

• Annual Scholarship for 4 years from Bharat Petroleum for outstanding performance in school.

• Treasurer of Leo Club- Youth Wing of Lions International, India

What will you do if there is an over flow ?

- abhimanipal March 09, 2010Quick question. Does the deck have to be shuffled ?

If not then the question is trivial. First create 13 cards of heart, then spade, then diamonds and then clubs.

If the initial deck itself is shuffled, then it is a bit tricky. I would suggest creating the normal deck before then use some kind of bit map to randomly generate cards out of the deck

When you say return the node, what exactly does it mean ?Does it mean the address of the node ?

Is it necessary that we have to maintain the max element at the top of the stack. This is a linked list, so we can probably just store the address of the node containing the maximum values in a pointer.

Does that satisfy the requirement ?

How will you swap 2 things without the temp variable.... This is the whole point of this question

- abhimanipal March 05, 2010If the address of the head node is not given then this problem is quite tricky.

Other wise we store the address of the nodes in the path from the root to the first node. Then we go from the root to the 2 node. At each node we encounter we check the earlier stored path ....

You have changed the problem statement.

The original statement was function()=x. It makes a world of difference by putting the *

How about we have an array of structures. The structure has 2 fields. The number and the no. of instances that the number has occurred. This solution can solve the space problem as well

- abhimanipal February 21, 2010Can you give an example so as to why divide by 2 will not work ?

- abhimanipal February 21, 2010Very nicely explained

- abhimanipal February 21, 2010Structures are way advanced in C++

enums are a separate type in C++

definition of the main function is also different

Java compiles to a byte code which is machine independent

C++ has to be compiled every time you want to run on a new OS

In the context of BST there is a well known algorithm to find the common ancestor. I think that approach could be used here.

What do you guys think ?

XOR yields but it will not produce the right result. For example if the i/p stream is 1,2,3,1,2. The XOR of all these numbers will not be 0

- abhimanipal February 04, 2010One approach could be

Pick the numbers in order from 1 -n

First we pick 1 and put it in array A. Then A is

1

Now we pick 2. Then A is

1

1+2

2

Now we pick 3. Then A is

1

1+2

2

1+3

1+2+3

2+3

3

Now we pick 4. Then A is

1

1+2

2

1+3

1+2+3

2+3

3

1+4

1+2+4

2+4

1+3+4

1+2+3+4

2+3+4

3+4

4

This is the basic idea. Now each time any of the above summations is equal to the desired number, we can print the summation and increase the count.

Storing so many permutations is bad, can anyone optimize it even further

One approach could be

Pick the numbers in order from 1 -n

First we pick 1 and put it in array A. Then A is

1

Now we pick 2. Then A is

1

1+2

2

Now we pick 3. Then A is

1

1+2

2

1+3

1+2+3

2+3

3

Now we pick 4. Then A is

1

1+2

2

1+3

1+2+3

2+3

3

1+4

1+2+4

2+4

1+3+4

1+2+3+4

2+3+4

3+4

4

This is the basic idea. Now each time any of the above summations is equal to the desired number, we can print the summation and increase the count.

Storing so many permutations is bad, can anyone optimize it even further

We could use recursion

In the recursive function call the next node till the end of the list

When the stack is unwinding, use a counter to determine when you have reached the correct node.

The reasoning is that the last node will be processed first, then the second last, then the third last and so on

We could use recursion

In the recursive function call the next node till the end of the list

When the stack is unwinding, use a counter to determine when you have reached the correct node.

The reasoning is that the last node will be processed first, then the second last, then the third last and so on

Nope sorting the smaller array does not make any sense as you have to search for the values in the big array. So irrespective of the fact that the values in the small array are sorted or un sorted it does not make any difference

- abhimanipal February 03, 2010I cannot understand this XOR method. Can any one explain it in more detail ?

Another solution could be to sort the array. But this will take O(n) time

Why is this problem a binary problem ?

And why is weighing things with a scale a ternary problem ?

Good algorithm but how do you find the starting point of the loop ?

- abhimanipal February 03, 2010I have a question. How will you generate all the possible sequences. Generating all the sequences is the trick part not the summation

- abhimanipal February 03, 2010Even then .... For example its 3*3 tic tac toe game and I fill the square 1*1, the program has to check the square

1*1, 1*2, 1*3

1*1, 2*1, 3*1

1*1, 2*2, 3*3

I dont see how this can be done in O(1)

Depending upon the architecture of the machine, the most significant bit is either the left most or the right most. So one way could be to left shift or right shift by 1

- abhimanipal February 02, 2010Another solution could be

1.find the minimum and maximum numbers of array B,min_B,max_B. This will take time O(n)

2.In the array A find the first the last occurrence of the number such that the difference between the number and max_B is the smallest. For the examples given, it will be the last 5. Time complexity O(n)

3. Int the array A, find the last occurrence of the number such that the difference between the number and min_B is the smallest. Include a condition such that the number cannot lie after the number found in 2. Time complexity O(n)

How can it be done in O(n). If we are checking the contents of Row(n) wont it take O(n) time.

I think it will take O(n) + O(n) +O(n) + O(n)

Check through the row n, check through the column n, check through the left diagonal and the right diagonal

Why can't we use arrays to store large number of integers

We can use the Select Algorithm to find the median. This algorithm also has time complexity of O(n)

I dont think there is a polynomial time algorithm for prime factorization

My approach would be

for(i=0;i<1000;i++)

{

while(j)

{

j++

// check if this number can be written as i^j= X

// Break out of while loop if i^j > X

}

}

This solution is quite inefficient. But we can make it more efficient but ignoring certain values of i. For example

1. If number is odd we can ignore all even values of i

2. If the number% 5 is not 0, we can ignore all i which are multiples of 5

Are there any more such rules ?

I think checking if a number is prime or not will be more expensive than traversing though the list

- abhimanipal February 02, 2010C++ has booleans, string

C++ has public, private

C++ enums are separate types

C++ stronger type checking rules

C++ char constant is 1 byte, where as char constant in C is 4(size of int ) dependant

How can you access the individual bits ?

- abhimanipal February 01, 2010Why can't we convert the floats to string ans then do string compare

We can use sprintf to convert from float to string.

We wont have any accuracy related issued if we do string compare

Or am I missing some thing ?

I wrote a printf statement in the main and the code thrice... Each time with different definition of main. Each time I got the same error

timberlake {~} > gcc test.c -o test

test.c: In function âmainâ:

test.c:7: warning: return type of âmainâ is not âintâ

Then when I ran the code to see if there was any run time bug, to my surprise there was none

Can some one explain the logic a little bit ?

- abhimanipal January 31, 2010When you ask the system for 10 bytes of memory, the systems removes 10 bytes from the list of free bytes in the heap and gives it to you.

If you write in the 11 bytes, according to me this byte should still be in the list of free bytes. So there is a chance the system might give this byte to some body else. So your program will say memory corruption has occurred even when it has not. Some body else wrote data into the (x+1) byte

But it does... Say I want to access the 3 element of the 10th row, then all I got to do is write

printf("%d\n",*(p+ 9*R +3)

where R is the number of elements in each row

In simple words when your program crashes, a snap shot of the memory at that time (It may include registers as well ) is dumped on the screen. Remember Windows screen of death ?

More information can be found here

en.wikipedia.org/wiki/Core_dump

There is a program called the linker which does that

- abhimanipal January 31, 2010But why do we get this error ?

#define FUN(val1,val2) val1##val2

#define SQR(x,y) x##y

int main(int argc, char* argv[])

{

int val1=10;

int val2=20;

printf("%d\n",SQR(val1,val2));

// printf("%d\n",FUN(val1,val2));

return 0;

}

In this code the first printf works properly but the 2nd one fails. Is this because of some peculiarity in the ##operator ?

Well... If the question is to allot space for a 2D array of say 10*10 we can do something of this sort as well

int* p= (int *)malloc(sizeof(int)*10*10);

Does this satisfy the constraints ?

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

The N th largest node will also be (total nodes- N) smallest node. So we can do a simple in order traversal and stop when we reach the n nodes.

- abhimanipal March 09, 2010To know when we have reached the correct node we can keep a static variable