# Activity Selection problem

Activity Selection problem, You are given n activities with their start and finish times. Select the maximum number of activities that can be performed by a single person.

# Next greater element in an array

Algorithm to find next greater element in array for current element. If we do linear search then it would take O(n^2) but here we are going to use stack to implement this algorithm. It will going to take O(n) time.

# Detect a loop in a linked list and how it works

Here we are going to use runner techniques, where there will be a two pointers slow and fast. Fast will going to take double steps then slow one, Lets see in below image.

# Find a peak element in an array

This algorithm to find peak element in an array, Peak element is an element which has greater value than its left and right element. one way to get peak element is using linear search which takes O(n), but we can also search using binary algo.

# Lowest Common Ancestor

This is to find lowest common ancestor node for two nodes in tree.

# Find all possible paths in matrix

This is to find all possible paths starting from left top corner of matrix to right bottom corner But we have constrain on this. You can only move Right or bottom and we also have blocking, Here blocking means 0 and path means 1. You can move to particular right or bottom if we have… Read more

# Apache Velocity Part 8 – Properties

You can store, access and modify properties available in Velocity class. Velocity has its own default properties available at below path. “org/apache/velocity/runtime/defaults/velocity.properties”

# Apache Velocity Part 7 – Context

In Apache velocity, There are three main ways to pass data from Java class to VM template. 1. Key and Value mapping 2. Key and Bean/POJO (Object) mapping 3. Key and Inner Map mapping

# Apache Velocity Part 6 – include and parse

In velocity template you can import local file using include or you can import other template using parse. #include – Include content of file in template. template engine is not going to rendered included files. #parse – Include template in other template. template engine will rendered this file. Note : #include( “sample.txt”, \$sampleFile ) you… Read more

# Apache Velocity Part 5 – condition #if

Apache Velocity has if condition like all other programming language. Find below syntax of #if in velocity.