Sorting Interview Questions
- 0of 0 votes
AnswersThanks for the suggestions I was trying to answer this question: Write a program that takes as input a string of only letters and displays the string with every third letter capitalized starting with the second letter, and all other letters lower-case.
- smyrumcs February 15, 2018 in United States
What is optimal implementation
Question is also Describer here:
https://stackoverflow.com/questions/9713205/string-manipulation-java| Report Duplicate | Flag | PURGE
Sorting - 0of 0 votes
AnswersI want to learn some big words so people think I'm smart.
- Ajibz May 11, 2017 in United States
I opened up a dictionary to a page in the middle and started flipping through, looking for words I didn't know. I put each word I didn't know at increasing indices in a huge array I created in memory. When I reached the end of the dictionary, I started from the beginning and did the same thing until I reached the page I started at.
Now I have an array of words that are mostly alphabetical, except they start somewhere in the middle of the alphabet, reach the end, and then start from the beginning of the alphabet. In other words, this is an alphabetically ordered array that has been "rotated." For example:
String[] words = new String[]{
"ptolemaic",
"retrograde",
"supplant",
"undulate",
"xenoepist",
"asymptote", // <-- rotates here!
"babka",
"banoffee",
"engender",
"karpatka",
"othellolagkage",
};
Write a function for finding the index of the "rotation point," which is where I started working from the beginning of the dictionary. This array is huge (there are lots of words I don't know) so we want to be efficient here.| Report Duplicate | Flag | PURGE
Facebook Development Support Engineer Sorting - 0of 0 votes
AnswersYou are given an array with duplicates. You have to sort the array with decreasing frequency of elements. If two elements have the same frequency, sort them by their actual value in increasing order.
- sonesh April 18, 2017 in United States
Ex: [2 3 5 3 7 9 5 3 7]
Output: [3 3 3 5 5 7 7 2 9]| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Sorting - 0of 0 votes
AnswersYou are given a rotated sorted array of size N. You have to search a given number into it.
- sonesh April 18, 2017 in United States
Example: [4,6,8,14,90,-9,-2,0,3], Search -2.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays Sorting - 0of 0 votes
AnswersIt was an over email interview:
- yasharonline January 11, 2017 in United States
Write a program that takes as input a sufficiently large text document (several are available online for testing; e.g. via Project Gutenberg), and produces as output (via stdout) an alphabetical listing of each unique word in the document (case insensitive and space separated, though be careful to consider hyphenated words), along with the lines from the input document that the word appears on. Each unique word (and the list of lines that it appears on) should be on a separate line in the output.
For example, taking the following text as input:
This is
some kind OF text it
Is an example of text
The following would be the output:
an 3
example 3
is 1 3
it 2
kind 2
of 2 3
some 2
text 2 3
this 1| Report Duplicate | Flag | PURGE
Apkudo SDE1 Sorting - 0of 0 votes
AnswersGiven a large terabytes of text file, sort the words in the file. Explain how it can be done in Mapreduce and Spark.
- penma May 17, 2016 in United States| Report Duplicate | Flag | PURGE
Accenture Sorting - -1of 1 vote
AnswersProvide a function that allow to compare two strings lexicography, having in mind that these words may contain digraphs (two letters together represents a single one i.e in Spanish ch is a single character ).
- urodba April 07, 2016 in United States
This in order to be able to sort a list of words.| Report Duplicate | Flag | PURGE
Google Software Developer Sorting - 0of 0 votes
AnswersImplement an algorithm that takes a adjacency list and produces a topological sort of the vertices.
- J@sper November 26, 2015 in United States
INPUT:
1 2
1 3
1 4
3 5
2 5
4 5
Returns:
1 2 3 4 5| Report Duplicate | Flag | PURGE
Google Jr. Software Engineer Sorting - 2of 2 votes
AnswersRound 6
- sonesh July 12, 2015 in United States
Question 3 : You are given a word document, you have to print the words with frequencies. Now print the kth rank word in terms of frequency. Print top k words as well by frequencies| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays Coding Sorting - 0of 0 votes
AnswersRound 5
- sonesh July 12, 2015 in United States
Question 5 : Now lets say you are given k number of input streams, each stream have two method implemented, one is ReadNextNumber() and another is WriteToStream(), lets say each of the streams are sorted. How will you return a single sorted stream which contains all the streams data.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays Sorting - -1of 1 vote
AnswersRound 5
- sonesh July 12, 2015 in United States
Question 4 : Now lets say you have 1 PB(1000 TB) of numbers, what kind of system you would prefer, not that you can't store this data in one box. How will you sort these many numbers, what is the time complexity in seconds ?. does increasing core per machine help here ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays Data Structures Distributed Computing Sorting - -1of 1 vote
AnswerRound 5
- sonesh July 12, 2015 in United States
Question 3 : Now lets say you have 1 TB(1000 GB) of numbers, how do you sort it, tell me the complexity in seconds ?, any optimization you would like to do here, ?, lets say your machine is having two core, now ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Sorting - -1of 1 vote
AnswersRound 5
- sonesh July 12, 2015 in United States
Question 2 : You are given a 1 GB of numbers, you have to sort them. Tell me the time required in seconds ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Sorting - -5of 7 votes
AnswersSort an integer array with three functions: findMin(), findMedium(), findMax().
- VV April 17, 2015 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Sorting - 0of 0 votes
AnswersThis was asked in an Online written test that was timed (60 mins). And this question was one among the three.
- Jeanclaude March 03, 2015 in United States
"Write a method to merge three sorted integer arrays into just one array"
Nothing more or less was given. Since it was a written test I assumed that the 1st array had space towards to end which can fit the other two arrays. I can code this but given the timer limitations (of 20 mins per question) I thought it was a bit too much for me to handle unless there is a more obvious way to do this. I did it using two arrays and using the resultant array, I merged it with the 3rd array. That was the best i could think of at that time.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Sorting - 2of 2 votes
Answers{{
- skc25pma February 02, 2015 in India
There are 3 machines M1, M2 and M3. Each machine is 90% full of its capacity with integers. Now you have to sort all the integers combined and then store the first 1/3rd in M1, second 1/3rd in M2 and last 1/3rd in M3.
Your objective is to minimize the number of sort operations and number of data transfer operations.
Each sort operation/data transfer operation is counted as 1 irrespective of the count of values that are being sorted/transferred.
}}| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm Coding Sorting - 2of 2 votes
AnswersAn efficient way to sort patient files in an array of just 3 types 'High-importance', 'Mid-importance', 'Low-importance' which are in an arbitrary order (unsorted).
- Ipalibo December 19, 2014 in United States
The output preference should start with the highest.
1. High-importance
2. Mid-importance
3. Low-importance
[high,low,low,med,high,low]
ps I was told to take advantage of the fact that they are just only 3 types.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Sorting - 0of 0 votes
AnswerWhats the difference between quick sort and merge sort? Which one to use? Do we need file sorted before merge sort?
- newbee September 17, 2014 in United States| Report Duplicate | Flag | PURGE
Intuit Senior Software Development Engineer Sorting - 5of 5 votes
AnswersGiven a Sorted integer array which is rotated N number of times. You have no idea what that N is. An element in the array can occur more for any number of time. Write a method to search the position of a given element. If there are more than one of the same element, return the position of the first element.
- jeevanus September 04, 2014 in India for Microsoft CRM| Report Duplicate | Flag | PURGE
Microsoft SDE1 Algorithm Data Structures Sorting - 0of 2 votes
AnswersDesign a system like friend's functionality in facebook. should have all features of facebook's friends functionality. like for each person , he can have any number of friends , he will get suggestions for new firends , showing common friends if we visits any other profile . algo should be scalable , robust .
- gopi.komanduri August 02, 2014 in United States| Report Duplicate | Flag | PURGE
Computer Scientist Algorithm Android Application / UI Design Arrays Bit Manipulation C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Database Distributed Computing Dynamic Programming Hash Table Java Large Scale Computing Linked Lists Math & Computation Object Oriented Design Problem Solving Sorting SQL Stacks System Design Trees and Graphs XML - 0of 2 votes
AnswersHow to design a multi key hash map ( key count can be dynamic. if there are two keys , initiallly which can be used to find the value , keys can be increased to three as well ex: consider school structure. Intially , consider , student id is key , later , should be searchable even with key name , later with grade.
- gopi.komanduri July 05, 2014 in India| Report Duplicate | Flag | PURGE
Analyst Algorithm Arrays C# C++ Coding Data Structures Dynamic Programming Experience Hash Table Large Scale Computing Linked Lists Problem Solving Sorting Trees and Graphs - 0of 0 votes
AnswersGiven 2 sorted lists that are of even and equal size, output the median. If there is no middle number, return the average of the 2 middle numbers
- valheru April 23, 2014 in United States| Report Duplicate | Flag | PURGE
Big Fish iOS Developer Sorting Amazon SDE-2 Algorithm - 1of 1 vote
AnswersGiven a list of n sorted lists of numbers, write a method that returns one giant list of all the numbers in order.
- valheru April 23, 2014 in United States
Example input:
NSArray* input = @[
@[@2, @5, @10],
@[@25, @100, @105],
@[@7, @56, @42],
.......
];| Report Duplicate | Flag | PURGE
Facebook iOS Developer Sorting - 0of 2 votes
AnswersGiven an array say [0,1,2,3,5,6,7,11,12,14,20]
- i_learn April 11, 2014 in India
given a number say 5.
Now find the sum of elements which sum to 5
eg:2+3=5, 0+5=5 etc.
I guess the interviewer wanted all possible combinations eg 0+2+3=5, etc| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance Algorithm Android Application / UI Design Arrays Coding Data Structures Dynamic Programming Perl Sorting test Testing - -1of 1 vote
AnswersImplement a sorting algorithm for a single linked list.
- meh March 23, 2014 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Sorting - 9of 9 votes
AnswersWrite a program for finding a minimum element in rotated sorted array(either ascending or descending ) and array contains duplicates.
- kesar February 02, 2014 in United States| Report Duplicate | Flag | PURGE
Algorithm Arrays C Sorting C# - 2of 4 votes
AnswersGiven a sorted array of integers, write a function that will return the number with the biggest number of repetitions.
- GeorgyBoy December 30, 2013 in Israel
(Asked to refine the solution to be more efficient)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm Arrays Coding Data Structures Problem Solving Sorting - -1of 1 vote
AnswersExplain Mergesort and Hashtable
- unicorn November 16, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Sorting - -1of 1 vote
AnswersExplain Binary Search Tree. What is its time complexity?
- unicorn November 07, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Sorting