Archives
Popular Posts
- How to filter records in postgreys table with bytea field ?
- Create custom session handler in php using mysql database
- Find second highest number in an integer Array
- Given a dictionary and a list of letters find all valid words that can be built with the letters
- How to write bold and italic text in whatsApp message
- Install Laravel in Mac OS X and Linux
- Implementation of Golang routines
- Solo trip is not a fun. It’s just a time when you explore yourself and world together.
- Print all nodes of binary tree at distance k from a given node
- Implementation of Finite State Machine
-
Join 142 other subscribers
Monthly Archives: June 2014
Determine given binary search tree is avl (Adelson-velskii and Landis) Tree or not
A binary search tree is called AVL tree when for any node x, the height of left subtree of x and height of right subtree of x differ by at most 1. Here function which check whether a given BST … Continue reading
Posted in Algorithm, c++, Data Structure, interview Question, Programming
Tagged AVL tree, binary search tree
Leave a comment
Print Right View of a Binary Tree
Printing right view of binary tree is similar to printing left view of binary tree instead of printing each level first node print last node of each level. which will give us right view of a binary tree. below function … Continue reading
Print Left View of a Binary Tree
Below is a function which uses two queues which stores the current and next nodes value for printing left view of a binary tree. when we are swapping elements from next nodes queue to current node queue just print from … Continue reading
Posted in c++, Data Structure, interview Question, Programming
Tagged binary tree, queue
Leave a comment
Find kth smallest element in Binary Search Tree
We can find kth smallest element in binary search tree using in order traversal because in order traversal of a binary search tree is a shorted list. above mention function is member function of my Binary Search Tree ADT class … Continue reading
Posted in Algorithm, c++, Data Structure, interview Question, Programming
Tagged binary search tree, recursion
1 Comment
Construct balanced Binary Search Tree using sorted Array
Here is complete program to construct balanced Binary Search Tree using sorted Array check in github A Developer Gy@n!
Posted in Algorithm, c++, Data Structure, interview Question, Programming
Tagged array, binary search tree
Leave a comment
Check whether the given Binary Tree is a Binary Search Tree(BST) or not
To find out given binary tree is a BST or not just check BST property recursively for each node. Below is function which will accomplish this. But above function will give wrong result for below tree because we are just … Continue reading
Posted in Algorithm, Data Structure, interview Question, Programming
Tagged binary search tree, binary tree, recursion
Leave a comment
Find Lowest Common Ancestor of two given nodes in Binary Search Tree
Assume we have following Binary Search Tree Then LCA of 8 and 12 will be 10 Here is function which will return LCA of two given nodes in a binary Search Tree above mention function is member function of my … Continue reading
Posted in c++, Data Structure, interview Question, Programming
Tagged binary search tree, binary tree
Leave a comment
Delete a given node in Binary Search Tree
Deletion of a node in Binary Tree is easy because we don’t bother about the relationship between children and parents their value may be less or greater then. In Binary Search Tree when we delete A node after that we … Continue reading
Posted in c++, Data Structure, interview Question, Programming
Tagged binary search tree, binary tree, recursion, tree
Leave a comment
Find minimum element in the Binary Search Tree
1. Recursive Function: 2. Non-Recursive Function: above mention functions are member function of my Binary Search Tree ADT class you can check complete program here A Developer Gy@n!
Posted in c++, Data Structure, interview Question, Programming
Tagged binary search tree, binary tree, recursion, tree
Leave a comment
Find maximum element in the Binary Search Tree
1. Recursive function : 2.Non-Recursive function: above mention functions are member function of my Binary Search Tree ADT class you can check complete program here A Developer Gy@n!
Posted in c++, Data Structure, interview Question, Programming
Tagged binary search tree, binary tree, recursion, tree
Leave a comment
Find a given element in Binary Search Tree
This can be done using recursive function as well as non -recursive function . In binary search tree average worst case time complexity is O(logn) 1. Recursive function: 2. Non-recursive function : above mention functions are member function of my … Continue reading
Posted in c++, Data Structure, interview Question, Programming
Tagged binary search tree
Leave a comment
Function to print all Ancestors of a given node in Binary Tree
above mention function is member function of my Tree ADT class you can check complete program here A Developer Gy@n!
Posted in c++, Data Structure, interview Question, Programming
Tagged binary tree, tree
Leave a comment