Interview questions

Algorithm interview questions – page 8

811 questions. Tap “Show answer” to check yourself.

  1. Implement a transaction manager in a database server. The discussion involved a lot of stuff about transaction logs.

  2. Write a program in c to store details of 100 books of a library where each record contains booknumber, book name, bookauthor, publisher, number of copies,unit cost. Read the data from an external file. Implement insertion o...

  3. Implement the function bool isRegex(char *reg, char *string); This function is passed two strings : a regular expression, consisting of the [a-z] and the * and ? characters. We had to check if the string matched the supplied regular expression. Fo...

  4. Implement the unix command WordCount (wc) using lenguage of your choice. The method takes a string and returns the number of words in the string, number of chars and the number of lines.

  5. You are given 2 log files each having 1 billion entries and each entry has a unique customer id.You need to print the records in two files which are common.

  6. Design a 7 sided dice from a 5 sided dice i..e given a dice which will give results in the range of 1-5 how do you get results in the range of 1-7 from the same dice.

  7. Given an array A[], write a function to separate even and odd numbers (i.e., put all even numbers first than odd numbers)

  8. Sort a given data according to its weight and relevance.(relevance was provided)

  9. Given an array & target value. Find a,b,c such that a+b+c=target focus time & space

  10. You are getting a number of two-tuple values <time, val>, where time is non-decreasing. Then a query asks for the value at a particular time. If a tuple exists for that time, it returns the val. Otherwise it returns val from the tuple that i...

  11. Given natural numbers 1 to infinity

  12. Given a string, u need to print all cases of letters without changing the order

  13. Write a program to arrange numbers from 1 to 16 such that the sum of two consecutive numbers is a perfect square.

  14. There are 8 characters and the probability of their occurrence is 1/2, 1/4, 1/81/256. How will u represent it in binary using minimum no. of bits ?

  15. You have a screen that consists of pixel. x,y identifies a pixel in the screen. How to convert x,y value to store the pixel information in one dimensional array. Store pixel(x,y) = array[n].

  16. Why binary search in not effective for linked list explain in detail

  17. Write a program to create a backup utility. Programming language allowed: C, Shell Scripting.

  18. Given two sorted positive integer rrays A(n) and B(n). We define a set S = {(a,b) such that a in A and b in B}. Obviously there are n^2 elements in S. The value of such a pair is defined as Val(a,b) = a + b. Now we want to get the n pairs from S w...

  19. Write down a program to print fibonacci series in C.

  20. You have an array with n elements. The elements are either 0 or 1. You want to split the array into kcontiguous subarrays. The size of each subarray can vary between ceil(n/2k) and floor(3n/2k). You can assume that k << n. After you split th...

  21. What is the most efficient way to Compare two text documents? Also we need to find the percentage by which They match..

  22. Why should we use data warehousing and how can you extract data for analysis with example?

  23. Given an array, find two numbers a and b such that |a + b| is smallest.

  24. Lucky numbers are numbers whose prime factors are just 2, 3, 5. Find the first k lucky numbers.

  25. Wat is the no of spanning trees in a n-tree if all the edges have equal weights

  26. Write a function to check if two rectangles defined as below overlap or not.

  27. You have a array of int. Elements of the array are in sequential order. For example, {0,1,2,3}, {0,1,2,3,4,5}. Now, you have given an array and only one sequence is missing. How will you determine which sequence number is missing. {0,1,2,4,5,6}, H...

  28. 3. Given a number of nodes N of a binary tree , how many structurally different full binary trees are possible. A binary tree is said to be full binary tree , if for every node in the tree there exists exactly zero or 2 children.

  29. Given a string, print all the English words in the given string. For example if the given string is "abc cat is defg kjklj" then your program should print "cat" & "is"

  30. Given a 2D array, find the kth largest sum of two elements picked from this array.

Companies that ask Algorithm questions