Epic Systems Interview Question for Software Engineer / Developers






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

Space Complexity:

QuickSort: O(logn)~O(n)
Bubble: O(1)
Insertion: O(1)
Merge: O(n)
BS: O(n)

- eastflag163 October 27, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

They have asked memory efficient not time efficient
It has to be bubble and insertion sort...memory usage O(1)

- Anon September 01, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Why quick sort takes O(logn). Quick sort is in-place sorting algorithm. it takes constant amount of memory other than the input array to sort the array.

- Anji September 07, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Bubble or insertion, yes.
But on more comlex side, "in place" merge sort is also the one with no addition memory overhead. Pick yours!

- Anonymous September 04, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

space complexity:
Quick = O(1)
Bubble = O(1)
Insertion = O(1)
Merge = O(n)

Time complexities:
Quick sort: Best O(n), Average: O(nlogn), Worst case: O(n^2)
Insertion sort: Best O(n), Worst Case: O(n^2)
Bubble sort: O(n^2) (best/worst)
Merge Sort: O(nlogn)(best/worst)

So quick sort is the best algorithms, considering its time and space complexity.

- Anji September 07, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

If you do a quick sort on a linked list, space complexity is O(n). On an array, it is O(logn) on average, since its number of recursive calls will be O(logn) on average.

- Sean September 07, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

space complexity of Quick sort on array is O(1).

Because at each recursive call one element position will be fixed (with only O(1) extra memory for swapping elements). there will be 2 recursive calls one on the left part and one on the right part. We can use the same original array for the recursive calls also.

So How can it take O(logn) Memory. Can you explain.

- Anji September 10, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I second Anji. Immaterial of the number of recursive calls in a quicksort, all of them act on the same original array, fixing the position of one particular element {pivot/split value} per call.So its in place, even with a recursive implementation. In fact there is no need of a scratch area, at all. That's not the case with merge sort. It does not sort in place.

- amit September 19, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Even if you swap elements in space, the recursive function will automatically create the stack to maintain some variables. If we don't use recursive function, we still need a stack to maintain these variables by ourselves. And the space complexity of the stack is O(logn)

- ydyyfshsh November 23, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

The merge-sort has an O(nlogn) comparison-based sorting algorithm. It requires very little memory, and the memory required does not depend on the number of data elements. Hence, merge-sort is the best in terms of efficient memory usages.

- Professor May 25, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.io.*;
import java.util.*;

class replace
{
public static void main(String [] args)
{
String totest[];
int i;
String test="She is a Hot girl";
String newString="";
StringTokenizer st= new StringTokenizer(test);

while(st.hasMoreTokens())
{
String temp=st.nextToken();
if( temp.compareTo("a")==0)
newString=newString+"the ";
else
newString= newString+ temp + " ";

}
System.out.println(newString);

}
}

- Anonymous October 09, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.io.*;
import java.util.*;

class replace
{
public static void main(String [] args)
{
String totest[];
int i;
String test="She is a Hot girl";
String newString="";
StringTokenizer st= new StringTokenizer(test);

while(st.hasMoreTokens())
{
String temp=st.nextToken();
if( temp.compareTo("a")==0)
newString=newString+"the ";
else
newString= newString+ temp + " ";

}
System.out.println(newString);

}
}

- Anonymous October 09, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Many of you are forgetting the memory used when a stack frame is stored during a recursive call.

Take a look at hxxp://en.wikipedia.org/wiki/Sorting_algorithm#Comparison_of_algorithms

- Anonymous October 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

it depends on the context.... Merge is the best.... what is this binary search sorting algorithm??
Never heard of it..

- raj August 28, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

U r sersly one idiot son of a bitch .....

- Fcker_24X7 November 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

U r sersly one idiot son of a bitch .....

- Fcker_24X7 November 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

put each element in a binary tree then do inorder traversal

- cunomad August 29, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Merge is definitely not the best for memory efficient.
Quick = O(logn)
Bubble = O(1)
Insertion = O(1)
Merge = O(n)

for Binary search, if counting the result storage, O(n)

So bubble and insertion are best.

- Anonymous August 29, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 votes

It should be Merge(nlogn)
Quick(nlogn)--->average case O(n^2) worst case
Insertion O(n) best case ...O(n^2) worst case
bubble -->O(n^2)...so merge is the best but is memory ineffecient!!

- Anonymous September 01, 2009 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

I think quick sort is the best of the sorting algorithms, although it may be difficult to code and implement , but quick sort with an efficiency of O(n) is the best among the sorting algorithms...

- Nishit August 31, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

I think bubble, insertion sort and quick sort are most **memory** efficient. And the storage complexity is not O(1). It's O(n). How can it be O(1)? Surely they are in place algorithms. But do you think a 5 element input array will occupy the same storage space as 50 element input array? If no then how the storage space is O(1). It depends on the input size. merge sort takes more space in addition to O(n) of input size.

- Anonymous February 17, 2010 | Flag Reply


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