Google Interview Question for Interns


Country: United States
Interview Type: Written Test




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

external sort

- Vincent August 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

Another way to do this is use to Parallel Processing frameworks like Map/Reduce.

- chandershivdasani August 20, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

video.google.com/videoplay?docid=-978892635109400080

- tester August 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

how can I get the rest of this video/lecture series?

- mygooglizer September 02, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 3 vote

What's a query?
Generally, divide input into 1000 batches, sort and output to different files. Then merge consecutively.

- Martin August 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

That is what external sort internally does

- chandershivdasani August 20, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

or Radix sort (More complicated)

- Vincent August 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Bucket Sort would be the way to go or you can also use InsSort (Merge+Insertion).

- anonymous August 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

N-Way Merge Sort

- Evan August 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

first devide the array into size of cache.sort each array separately and then apply merge sort in group of two recursively

- amol kamble,sunil kuntal August 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think Redix sort and Bucket sort can be performed until we know what kind of data is in file. Redix sort can be done if data is integer and Bucket sort can be done if data is in certain range.

- Andy2000 August 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I was wondering if Bit Vectors can be used?

- Andy2000 August 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I was wondering if Bit Vectors can be used?

- Andy2000 August 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

hello friends for this we don't need external sorting
10,00,000 instructions
1,000 at a time can sort
if we divide 10,00,000 instructions into 500 blocks
first sort first 2 block
then take last 500 sorted instruction and next 500 unsorted instructions ...sort them
now take first 500 sorted instruction of last sorted instruction and and above 500 instruction and sort them now we have 1500 sorted instruction similarly take next 500 instruction and make 2,000 sorted instruction and so on

for example
we have 16 integer and at a time i can take only 4 integer in memory and can perform sorting over then
5,6,1,3,2,3,1,1,7,6,3,8,8,7,6,5
divide them in block of 2 so it become
[5,6],[1,3],[2,3],[1,1],[7,6],[3,8],[8,7],[6,5]
now take first 2 block and sort them
[1,3],[5,6].......rest are unsorted
now take last sorted block and next unsorted block
and sort them
[1,3][2,3][5,6].....
then recursively sort the previous 2 blocks ([1,3]&[2,3]) until no block to sorted
1,2,3,3,5,6(sorted)........unsorted rest blocks
similarly extend it and finally u get all sorted list

thank u
i hope u understand

- Akhtar Qureshi September 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

it's just a bubble sort

- fx19880617 September 25, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@Akhtar Qureshi
How do you store 1 million numbers into the memory ? (as you can store up to 1 thousand)

- ZuZu May 10, 2013 | 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