Check whether Strings are k distance apart or not

Given two strings, the task is to find if they are only less than or equal to k edit distance apart. It means that strings are only k edit distance apart when there are only k mismatches. Print Yes if there are less than or equal to k mismatches, Else No. Also print yes if… Read More »

Bucket Sort To Sort an Array with Negative Numbers

We have discussed bucket sort in the main post on Bucket Sort . Bucket sort is mainly useful when input is uniformly distributed over a range. For example, consider the problem of sorting a large set of floating point numbers which are in range from 0.0 to 1.0 and are uniformly distributed across the range.… Read More »

exec family of functions in C

The exec family of functions replaces the current running process with a new process. It can be used to run a C program by using another C program. It comes under the header file unistd.h. There are many members in the exec family which are shown below with examples. execvp : Using this command, the created… Read More »

Classes and Objects in Java

Classes and Objects are basic concepts of Object Oriented Programming which revolve around the real life entities. Class A class is a user defined blueprint or prototype from which objects are created.  It represents the set of properties or methods that are common to all objects of one type. In general, class declarations can include… Read More »

Beginning Java programming with Hello World Example

The process of Java programming can be simplified in three steps: Create the program by typing it into a text editor and saving it to a file – Compile it by typing “javac” in the terminal window. Execute (or run) it by typing “java HelloWorld” in the terminal window. Below given  program is… Read More »

Hoare’s vs Lomuto partition scheme in QuickSort

We have discussed implementation of QuickSort using Lomuto partition scheme. Lomuto’s partition scheme is easy to implement as compare to Hoare scheme. Lomuto’s Partition Scheme partition(arr[], lo, hi) pivot = arr[hi] i = lo // place for swapping for j := lo to hi – 1 do if arr[j] <= pivot then swap arr[i] with… Read More »