Archive for June, 2012

why hash code is needed in java

June 24, 2012 Comments off
Categories: General

Searching and Sorting

June 16, 2012 Comments off

Time Complexities :

Searching :

Linear Search :

The worst-case time for a Linear Search is always O(N)

Binary Search :

For Binary search the values should be in a sorted manner.

The worst-case time for binary search is proportional to log2 N: the number of times N can be divided in half before there is nothing left. Using big-O notation, this is O(log N)

Don’t use binary search in the sorted Linked List if data

Reason : Binary search relies on being able to access the kth item in a sequence of values in O(1) time. This is possible when the values are stored in an array, but not when they’re stored in a linked list. So binary search using a linked list would usually be much slower than sequential search.


Links :

Categories: Algorithms

Creating a folder with todays date in Linux

June 3, 2012 Comments off
Categories: Linux/Unix

java – NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format

June 3, 2012 Comments off
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple; at .......... ........... ............ 

Reason:This kind of errors occurs in 2 cases 
In compatible slf4j version with log4j 
If your class path has multiple slf4j and log4j versions.  

Solution : Below log4j and slf4j combination worked for me. 
Categories: Errors & Exceptions
%d bloggers like this: