Ittiam Systems Interview Question for Software Engineer / Developers


Country: India
Interview Type: In-Person




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

O(NlogN) algo.

-> Write your partition function with pivot as x( x may not be present in the array)

-> Partition function returns index k such that all elements in [0,k] are less than 'x' and all elements in range [k+1, N-1] are greater than 'x' .

->Now sort [0,k] range in ascending and [k+1, N-1] in descending order using Quick Sort or some other O(NlogN) algo.

- Neeraj September 12, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1:Mark the element 'x' as key element and take it to one of the two corners of an array.
2:Arrange elements in such fashion that elements to its left are smaller than the key element and right are greater or vice-versa (requires atmost n comparisons).
3:Have 2 BST 1 for elements smaller than key element and other for elements greator than or equal to key element.
4:Have inorder traversal for ascending order.
5:And put elements into stack first by having inorder traversal and then pop out for descending order.

- ACEpratap September 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Complexity in big o() ???

- Rahul September 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Sort the array using quick sort in descending order
Find the index of key element in the array
Reverse the array from key elements' index + 1 element to the last element to get the ascending order

- amar September 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

The second step has to take possible multi appearance of the key into account.

- Anonymous September 12, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Question doesn't asks you to have array as "all less elements followed by greater elements". It may be mix as well but order for less and greater elements has to be maintained among themselves.

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

Quick sort and then take i+1 to n elements and reverse them. Here i is the index for the given element.

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

as no's can be mixed in either way....hence
algo :
for (i=0 to n)
check x to a[i] : if a[i]>=x then find max (a[i])
else find min(a[i])

end

- john abraham October 09, 2012 | 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