Interview questions
Algorithm interview questions – page 16
811 questions. Tap “Show answer” to check yourself.
-
A is an array containing both odd and even integers.Now without any preprocessing,rearrange this array such that the odd elements are in the first half and even nos in second half.odd numbers must be descendingly sorted and even numbers ascending ...
-
Given a lot of cuboid boxes with different length, breadth and height. We need to find the maximum subset which can fit into each other.
-
Given a matrix you have to find the shortest path from one point to another within the matrix. The cost of path is all the matrix entries on the way. You can move in any direction (up, down, left, right, diagonally)
-
In a given 2D array that has only 1s and 0s, find the maximal 2D sub array which has only 1s.
-
Given n elements & their is dependency between them it can linear or circular or any other dependency you can think of , you to explain the algorithm that tell the write order of execution of all program , he discussed about the data structure...
-
Given a word,convert it into a pallindrome with minimum addition of letters to it.letters can be added anywhere in the word.for eg if amazon is given result shud be amazonnozama .give a optimize soln
-
Write a data structure to count number of connections on web server in last 1 minute.
-
Given an array of n elements and an integer k where k<n. The array is already sorted in groups of size k. So elements {a[0], ... a[k] and a[k+1] ... a[n] are already sorted. Give an algorithm to sort in O(n) time and O(1) space.
-
Explain merge sort and quick sort, and compare them.
-
Given an array of n elements and an integer k where k<n. Elements {a[0]...a[k] and a[k+1]...a[n] are already sorted. Give an algorithm to sort in O(n) time and O(1) space.
-
Define three operations LEFT, RIGHT, ENCLOSE .. The result of applying each of these operation on x (x is in itself a combination of such parenthesis) gives the result : ()x , x() and (x) respectively.
-
Generating mnemonics of a phone keypad
-
How would you find maximum of 2 numbers without using relational operator. Now find maximum of 3 numbers, then 4 numbers.
-
Suppose we are given an array A[1 .. n] with the special property that A[1] A[2] and A[n 1] A[n]. We say that an element A[x] is a local minimum if it is less than or equal to both its neighbors, or more formally, if A[x â..
-
2.Removing d characters in Fibonacci position in a string and compacting it.
-
Write test cases to test a program given to check whether two numbers are anagram or not.
-
You have 'n' players who have played against each other and for each player you have 2 sets Win = { } Loose = { } which tells you what all players has a given player lost/won against.
-
Write a tcp server
-
Get the binary equivalent of a given number using only one variable.
-
Write pseudo code to implement a spell check program for the following case: If interchanging the adjacent two chars of a incorrect word makes it correct word in the dictionary, the spell check must automatically correct. Eg: rwite corrected...
-
Write an algorithm to check wether a given number is multiple of 5 or not? Make use of bitwise operators and concepts of GATES(OR, AND, XOR...)
-
Given a stream of numbers, write a function that maintains the median of numbers.
-
Write a function to find the nearest link on a webpage given the mouse x, y coordinates.
-
In our website, people enter addresses. Each address is made up of some lines. And each address can be represented as rows in a database. how would you design a system which would verify if the addresses are valid or not, that is if the address re...
-
Given The Linked List remove the all duplicates elements from it while order should be maintained i mean 3-1-2-1-2 so o/p should be 3-2-1 e.g order of linked list shouldn't be broken & we have to return the original linked list without d...
-
Give an algorithm to find the minimum-depth of a binary tree. A node is complete if it has both left & right child. Looking for a non-recursive approach.
-
You are given the amazon.com database which consists of names of millions of products. When a user enters a search query for particular object with the keyword say "foo", output all the products which have names having 50% or more similarity with ...
-
Given a graph , find out number of cycles
-
3.Given two arrays with one array containing m elements sorted and another array of size m+n containing n elements sorted at beginning where the last m positions are empty, write code to merge these two sorted arrays efficiently so that u have the...
-
You are provided with a stream of numbers, design a data structure to store the numbers in the stream along with their no. of occurrences