Featured Articles


C code for Converting while Loop to for Loop

Converting a while loop to for loop has always been an area of interest for the programmers. Many times, like while using OpenMp for parallelization of sequential C code, we have to convert all the while loops to for loop. The C code given below operates on the input file test.C and generates another file, for.C […]

Share

C code for Towers of Hanoi

The famous Towers of Hanoi problem has an elegant solution through recursion. In the problem, three pegs, A, B and C exist. ‘n’ disks of differing diameters are placed on peg A so that the larger disk is always below a smaller disk. The objective is to move all the disks to peg C using […]

Share

C code of a Pseudo Virus

As the name suggests, it is technically not a virus because it doesn’t perform all the tasks that a computer virus is intended to perform. Thus, this pseudo virus has an advantage over the ordinary viruses i.e. it cannot be detected by an antivirus software. However it does demonstrate the power of C by corrupting […]

Share

Linked List

Using data structures like array is a common solution to the problem of storing similar data types. However, the ordering of the items in as array is implicit. Hence we cant use an array to explicitly order the group of items. In such a case a linked list is used. The code of the most […]

Share

Sudoku Generate

The java program below shows how to generate practically infinite number of Sudoku puzzles. The logic behind the coding is quite simple. The whole program is divided in 2 parts : 1. A generater that  randomly selects 28-32 grids among the 81 grids and fills random digits (1-9) in these grids such that the conditions […]

Share

Mind Game

The coding given below is of a simple game in which the objective is to arrange the numbers in ascending order using direction keys. Playing the game is quite simple. Pressing the direction keys will cause the shifting of the blank space and the neighbouring numbers. The executable file can be downloaded from here : […]

Share
Trie example

C code for Radix Tree (or Trie)

A Trie is a very useful (but often ignored) data structue, which can be used to solve a large number of Strings related problems quickly. In terms of Time and Space complexity, following are the 2 main properties of Trie: Trie uses a Symbol Table approach (a Hash Map) like data structure for reducing the […]

Share
binary search tree

C Code for Binary Search Tree Traversal

A Binary Search Tree is a Binary Tree datastructure (a tree in which each node has at most two children) which has the following properties: The left subtree of a node contains only nodes with keys less than the node’s key. The right subtree of a node contains only nodes with keys greater than the […]

Share

Sorting Objects Using Comparable in java

So, sorting is a snap in Java – just use any Collection to store your objects and then just call Collections.sort(List<T>); which will internally call Arrays.sort(Object[] a); which eventually will use mergeSort. Source Code of Collections.sort(List) But, how will Java know, while sorting, how to compare different objects ? So for this, it uses Comparable […]

Share

Java code for Permutation using Steinhaus–Johnson–Trotter algorithm

Steinhaus–Johnson–Trotter algorithm is an efficient algorithm to find the permutations of a set of entities. The code given here use Even’s speedup to improve the running time of the algorithm by storing additional information for each element in the permutation: its position, and a direction (positive or negative) in which it is currently moving. The […]

Share
Stanford Computer Scientists Find Internet Security Flaw

Stanford Computer Scientists Find Internet Security Flaw

Stanford University researchers have found a security flaw in audio-based completely automated public Turing test to tell computers and humans apart (CAPTCHAs), which are designed to provide Internet security for the visually impaired. Audio CAPTCHAs require users to listen to a string of spoken letters or numbers disguised with background noise. However, Stanford professor John […]

Share
AWSOM Powered