# Blogs Hub

### by AskGif | Sep 01, 2018 | Category :coding

#### How to find the longest border of a string?

The border of a string is a substring which is both a proper prefix and proper suffix of the string &mdash; "proper" meaning that the whole string does not count as a substring. The longest border of x is "ab". The longest border of y is "abab" (the prefix and suffix can overlap). More de

### by AskGif | Aug 16, 2018 | Category :coding

#### Search an element in binary tree without recursion.

We can use level order traversal for solving this problem. The only change required in level order traversal is, instead of printing the date we just need to check whether the root data is equal to the element we want to search. source:&nbsp;Data Structures and Algorithms Made Easy in Jav

### by AskGif | Aug 16, 2018 | Category :coding

#### Find maximum element in binary tree without recursion.

We could have used either PreOrder, InOrder or PostOrder traversal to find the maximum in a Tree but as it is mentioned that we need to find the maximum without using Recursion. Using Level Order Traversal we can find the Maximum element. We just need to observe the elements data while de

### by AskGif | Aug 14, 2018 | Category :coding

#### How to implement Level Order Traversal in Binary Tree?

Trees can also be traversed in level-order, where we visit every node on a level before going to a lower level. This search is referred to as a breadth-first search (BFS), as the search tree is broadened as much as possible on each depth before going to the next depth. Java implementation

### by AskGif | Aug 09, 2018 | Category :coding

#### How to implement PostOrder Traversal in Binary Tree?

PostOrder Traversal is different from InOrder Traversal and PreOrder Traversal. In this Traversal approach we first traverse through left and then right and at the end, we traverse to the node data. In PostOrder traversal, the root is visited after both subtrees. PostOrder traversal is de

### by AskGif | Aug 09, 2018 | Category :coding

#### How to implement InOrder Traversal in Binary Tree?

The Technique for traversal in an Inorder is slightly different from what we were doing in PreOrder Traversal. Here we go through left node, then data and then the right node. In an InOrder traversal, the root is visited between the subtrees. InOrder traversal is defined as follows:

### by AskGif | Aug 09, 2018 | Category :coding

#### How to implement PreOrder Traversal in Binary Tree?

In pre-order traversal, each node is processed before (pre) either of it's sub-trees. This is the simplest traversal to understand. However, even though each node is processed before the subtrees, it still requires that some information must be maintained while moving down the tree. Preor

### by AskGif | Aug 08, 2018 | Category :coding

#### What is a Tree Data Structure?

A tree is a data structure similar to a linked list but instead of each node pointing simply to the next node in a linear fashion, each node points to a number of nodes. A tree is an example of non-linear data structures. A Tree structure is a way of representing the hierarchical nature of a stru

### by AskGif | Aug 08, 2018 | Category :coding

#### What is a Queue?

A queue is a data structure used for storing data (similar to Linked Lists and Stacks). In a queue, the order in which data arrives is important. In general, a queue is a line of people or things waiting to be served in sequential order starting at the beginning of the line or sequence. A

### by AskGif | Aug 08, 2018 | Category :coding

#### How can we get Minimum of Stack in a Constant Time O(1).

It is required to create a method getMinimum() which will give us the minimum in the current stack in O(1) time complexity. we will be using another stack for this to store the minimum at any particular point in time. We will take an auxiliary stack that maintains the minimum of all value

### by AskGif | Aug 08, 2018 | Category :coding

#### What is a Stack?

A stack is a simple data structure used for storing data (similar to Linked Lists). In stack the order in which the data arrives is important. The pile of plates of a cafeteria is a good example of a stack. The plates are added to the stack as they are cleaned. They are placed on the top. When a