Data Structure interview questions – page 19

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

Advertisement
  1. The number of total nodes in a complete balanced binary tree with n levels is, a)3^n + 1 b)2^(n+1) - 1 c) 2^n + 1 d) none of above

  2. Find 5th Maximum in BST given bst is of 4 / 2 6 / / 1 3 5 7

  3. Given an array of integers, {1,0,2,0,3,0,0,4,5,6,7,0,0,0}, you have to create a new array which will be like (1,2,3,4,5,6,7,0,0,0,0,0,0,0}, without using any other temporary array.

  4. Create a minimally skewed tree from the given Inorder. There can be many trees possible trees from Inorder, but we want minimally skewed.

  5. You have a binary search tree and you have to return the two nodes such that there sum i equal to 'K'. Pseudo code is to be given. O(n)time & O(n) sppace is easy but challenge O(n) time & O(1) space.

  6. You are provided with a stream of integers, design a data structure to store the number of occurrences of each integer.

  7. Find Level Sum of a binary tree and Store that in an Array? eg

  8. Write a Program to remove loop from linked list..program should be clean & should pass all test cases..he wants from me exact working code In O(n)..??

  9. Convert binary search tree to max heap

  10. You are given a singly link-list such that each node of this list is also a head of another link list of the same type. So, how does one flatten the linked-list

  11. Given a binary tree, find the largest subtree that's also a BST.

  12. Given a large string, you have to find out largest string such that all its character are consecutive.

  13. Advertisement
  14. Remove duplicates from a given unsorted array.

  15. Write a code to find the tree from a given tree such that each node in resultent node value= sum of it's childs

  16. Given a table of prefix rules (similar to regex) and the corresponding actions. Given a string, find the most specific rule that can be applied and carry out the corresponding action. For ex, a.*->f1() a.b.c.*->f2()<b...

  17. Removing all the repeated character of string in O(1) space given all would be in [A-Z a-z]

  18. To concatenate two linked lists strings, the order is O(1) is obtained for what kind of list?

  19. Implement your own hash map from scratch. Make it thread safe.

  20. 1) Given a stack and an input string of 1234.At any point you can do anyone of the follow i. take the next input symbol and Enque. ii. you can pop as many as you can. When ever you pop an element it will be printed (you cannot po...

  21. Given a long string, arrange the words in alphabetical order, delete the duplicates and output the words with their frequency.

  22. Given two sorted lists of size N1 and N2, find the median of all elements in O(log N) time where N = N1 + N2. ....

  23. Define a data struct for the search engine which will represent whether given word is there in the document or not .It should be fast.

  24. Write BST(Binary Search Tree) into file and read from file

  25. Given a pointer to a node in a singly linked list, how do you delete the node?

  26. Advertisement
  27. Find the median of a Binary Search Tree. You are passed the root of the tree, and you should return the median which is the middle element, if the number of elements is odd, or the average of the two middle elements if the number of elements is ev...

  28. You are given a threaded binary tree where each node of the tree points to some node to the right of it in-order traversal. Given such tree, check whether each thread pointer of the node in a tree satisfies this condition( i.e check whether if thr...

  29. A rooted binary tree with keys in its nodes has the binary search tree property (BST property) if, for every node, the keys in its left subtree are smaller than its own key, and the keys in its right subtree are larger than its own key. It has the...

  30. Program to tell if a singly linked list is circular.

  31. Given a distributed system with many clients and many servers where the servers each export a different set of services and each have a different amount of computing power discuss the data structures used in a router to perform load balancing. </p...

  32. Traverse a tree in preorder fashion

Advertisement