Interview questions
Algorithm interview questions – page 23
811 questions. Tap “Show answer” to check yourself.
-
Write a program to evaluate the expression infix expression (
-
How many vertices are required to obtain 1024 unique undirected graphs
-
Find the longest increasing subsequence in an array in O(nlogn).
-
Implement a lease and release mechanism. When the caller calls lease it returns the smallest available integer from a range. On release the number become available or leasing again. So for eg if 3 clients call lease thrice it would give 0, 1 and 2...
-
Suggest a data structure and algo to implement T9 dictionaries. Your solution should be optimized for adding a new word.
-
Come up with an optimal implementation for max() operation in a Stack.
-
Given a snapshot of an ongoing chess game, which probably is a one vs many game, identify whether it is a valid game or not.
-
Design (classes and class diagrams only) an object oriented Network Library that will facilitate.
-
You have two arrays A and B of strings. In the array B all element are from A except one. ex: A = {"abc", "bcd", "dpr"}; B = {"abc", "mnp", "bcd", "dpr"}; You have find out the string which is extra in B in O(n) time. In the abov...
-
Given k sorted arrays each of length n, construct a single merged and sorted array.focus on running time and space complexity
-
You are given a list of strings. Find a way to combine and store them in such a way that it you can retrieve the original strings.
-
Write a program in c to simulate process scheduling using queue data structure
-
Given an array of integers... Imagine it as a pyramid as below:
-
Find out the no. of vertices in a graph given the graph is: a) Undirected cyclic b) Directed Cyclic c) Undirected non cyclic d) Undirected non cyclic.
-
Given all 26 characters, generate all strings of length 'n' which do not contain a given string as a substring.
-
Write down the c code for finding out the maximum scope depth in a c code. A scope depth is increased by one with every '{' and decreases by one with every '}'
-
Given an array which contains elements from 1 to n. All numbers present once except following two exceptions: 1) one number is missing 2) one number occurs twice
-
Suppose we can compare two arrays like: {4,2,3} > {3,5,6} {4,2,3} < {4,3,0}
-
Function to display the directory structure in a user friendly way taking root dir as arg for a general OS. You may assume and state some basic APIs available in that OS
-
Check Whether binary representation of number is palindrome or not example
-
Giving a Grid in 2D array like this where each cell has a cost from 1-9
-
Write an algorithm to create the mirror image of a binary tree
-
Given a very big file of words, a word in each line, sort the words. Please provide the algorithm and explanation .
-
Write a function that divides two numbers without using division operator.
-
5. You have two threads T1 and T2 they are reader and writer respectively. With some specification: ADDNEW.Process PROCESS.SET PROCESS.RESET ENTER CS EXIT CS LOOP EXIT LOOP WAIT# PROCESS
-
Design a data structure to provide the mathematical operations +, - ,/ , * etc for the very very large numbers. Also, implement the + function for two such very very large numbers ...say numbers with 1 Million digits.
-
Find all pairs in array such that a+b=x, a != b. you have to specify all space and time complexities...fairly standard problem-
-
Given a million 3D points, how will you find the 10 closest to the origin?
-
An efficient method to count the number of occurrences of a number in a sorted array
-
Recursive Fibbonacci ...