Tech Architect interview questions – page 5

1,161 questions. Tap “Show answer” to check yourself.

Advertisement
  1. Given a sorted array arr[] and a number a, count the no. of occurences of x in arr[]. Logn solution expected.

  2. More on Hash tables, Chaining, Modulus, and Linked Hashing.

  3. You have 1000 names in random order and i ask you to pick any name of my choice randomly and then give me complete info of that person so what data structure yuo will use to store person info?

  4. Initially next_larger of every node is point to NULL. now write a c code which set all node's next_larger pointer. where next_largest point ...

  5. An array of integers. The sum of the array is known not to overflow an integer. Compute the sum. What if we know that integers are in 2's complement form?

  6. In the given linked list, odd numbered nodes are in increasing order and even numbered nodes are in decreasing order. How it can be sorted in increasing order?

  7. Given a very large file (millions of record), find the 10 largest numbers from it.

  8. Check for duplicates in an unsorted array in O(n) without using any extra space

  9. Design a data structure that can be used instead of an array and avoids the "high-cost" (i.e. O(n)) of initializing the array. the data structure ought to holds n items and supports the following operations in O(1) time: * Init  Initializ...

  10. Given a text file, implement a solution to find out if a pattern similar to wild cards can be detected. For example, find if a*b*cd*, or *win or *def* exists in the text.

  11. How will you raise a n x n matrix to the power k efficiently. What's the time complexity and space complexity of you algorithm? How will you optimize this?

  12. In a game, you bet using the following strategy. Whenever you lose a bet, you double the value of the bet for the next round. Whenever you win, the bet for the next round will be one dollar.

  13. Advertisement
  14. There is a file system on the disc. the disc has many sectors. Always the first sector has the information about all the files.

  15. Print all the paths from root to leaf nodes of binary tree depth of the tree is provided

  16. Print permutations of a given string in sorted order

  17. Suggest a data structure for finding median of a set. The data structure should also support efficient insertion and deletion.

  18. Maximum Sum of Sub Array in an Array.

  19. Given an array of n elements and a number x, find if there exist 3 elements in the array whose sum is equal to x. Do it in O(nLogn) time complexity

  20. You have given an array having alternative positive and negative number . you have to find out the longest subsequece having maximum sum.in the complexity o(n).

  21. There is a parking lot with n slots.. and n-1 cars with 1 free slot. given an initial arrangement of cars how will u arrive at a desired arrangement E.g say n = 5 .initial..{free, 1, 3, 4, 2} ..required ..{1, free, 2, 4, 3}.. the numbe...

  22. Suggest a data structure and algo to implement T9 dictionaries. Your solution should be optimized for adding a new word.

  23. Given an array such that the array will be sorted if we sort the elements between two indicies i an j. Find i and j for such an array such that abs(i-j) is minimum.

  24. 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.

  25. You are given a Linklist, you have to rotate it in order 3.

  26. Advertisement
  27. 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...

  28. Given an array of integers..... Imagine it as a pyramid as below:

  29. U r given an integer array of size n, filled with numbers 1 to n randomly. Each number occurs exactly once. Two of them are replaced by 0(zero). Find out those numbers in O(n) time.

  30. 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

  31. What data structure would you use to store distances between all the planets in a galaxy. (So there could be like a billion planets)

  32. Giving a Grid in 2D array like this where each cell has a cost from 1-9

Advertisement