FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Interview-Questions/04_Trees_and_Graphs at master · AlgorithmCrackers/Interview-Questions · GitHub

Latest commit

 

History

History

README.md

Trees and Graphs

Trees

  1. Given a binary tree and a sum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. - hasPathSum
  2. Write a program to verify whether the given tree is a binary search tree.( with and without using recursion) - isBST
  3. Check if all the leaves are at the same level in a binary tree - sameLevel
  4. Given a tree, find the path that sums up to a given number. - pathSum2
  5. Using a tree, find the first common ancestor of two nodes
  6. Print out the parent and children given a particular depth in a given tree.
  7. Determine if a tree is balanced. - isBalanced
  8. How to check whether a binary tree is identical to another binary tree? What is the time complexity? - sameTree
  9. Serialization and deserialization of a tree to a string. If every node of tree represents a letter serialize tree to string in a way that you can deserialize the same string to a tree again. 
  10. Nearest ancestor node of binary tree.
  11. Given the inorder traversal of a n-ary tree where every node can have either n or 0 children, and is marked "p" if that node has n children, or marked "q" if that node has 0 children, try reconstruct that tree.
  12. Convert each level of Binary tree into a linked list - levelOrderTraversal
  13. Given a binary tree(not necessarily BST), return the sum of all kth level nodes. What is the complexity?
  14. Level order traversal of a binary tree - levelOrderTraversal
  15. Write a function to find the total number of leaf nodes in a binary tree. countTheLeaves
  16. Given a binary tree, find its maximum depth. maximum-depth-of-binary-tree
  17. Invert Binary Tree invert-binary-tree
  18. Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s subtree-of-another-tree

Questions 8, 16, 17 are part of Team Blind's curated list

Graphs

  • You are given a list of projects and a list of dependencies. All of a project's dependencies must be built before the project is. Find a build order that will allow the projects to be built. If there is no valid build order return an error. - projectDependencies
  • Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. - numberOfIslands

Sources


Back | FazBrowse Home | New Git URL