Adobe Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

generic Qsort in C. May be STL is also providing same kind of thing.
void qsort(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *));

- Tulley February 14, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

maintaining a generic linked list and then sorting the list accordingly while manipulating pointers seems to be the most memory efficient solution. What say?

- fabregas February 15, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i am not sure what interviewer want..
he said that, sorting function can sort anything ..
i replied that if comparision is not define how fuction can sort element ... i gave example like comparision of complex number is not defined.. but user can define by comparing real part or complex part or both ... i questioned that how generic function find out this !!!

- santosh February 15, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

i am not sure what interviewer want..
he said that, sorting function can sort anything ..
i replied that if comparision is not define how fuction can sort element ... i gave example like comparision of complex number is not defined.. but user can define by comparing real part or complex part or both ... i questioned that how generic function find out this !!!

- santosh February 15, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

i am not sure what interviewer want..
he said that, sorting function can sort anything ..
i replied that if comparision is not define how fuction can sort element ... i gave example like comparision of complex number is not defined.. but user can define by comparing real part or complex part or both ... i questioned that how generic function find out this !!!

- santosh February 15, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hi.
Any sorting algo has 2 basic operations: comparision & swapping.
Hence if we have 2 generic API's for them it would be enough.

typedef void (*Swapfunc)(void *element_1, void *element_2);

typedef int (*Cmpfunc)(void *element_1, void *element_2);

void GenericSort(void *array, uint32_t nbElems, Swapfunc swapFunc, Cmpfunc cmpFunc);

- JobSeeker February 15, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

He means to use template

- Anonymous February 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I was asked this same question. He said not to use template because he wanted a solution in C. I gave the same answer as Tulley i.e.
void qsort(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *));
He was satisfied with it.

- um February 20, 2011 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More