Shop Smart - Basic Layout
If you are here, then I am sure that you know about the Shop Smart web application, if not then please visit Shop Smart web application. The first step for application development is to finalize the first phase of requirements. A minimal requirement so that at least we can start with something. We will start with the subset of the requirements mentioned here.
To give you a feel of the basic layout, here is the wire frame.
Few Components of the web application
We need to understand the various components in the application, let us mention just three of them fo...

Read More
## Shop Smart

Introduction
After a lot of queries from friends and followers I am planning to start a tutorial where we will learn to build today's e-commerce web application from scratch.
I do not expect any one to know anything other than the basics of Java programming language. It is alright if you do not know any UI programming (CSS, Javascript, JQuery etc). We will learn everything slowly and steadily.
By the end of this tutorial the readers will completely understand various aspects of enterprise applications and will be able to build any sort of enterprise application with confidence and witho...

Read More
## Combination of Numbers

Introduction
I already have one post on this blog which explains the permutations code, now its time for the combinations.
The idea behind Combination of Numbers
Combination by definition is a concept of discrete mathematics which essentially relates to the act of selecting a list of items from a collection. For e.g. If I have to pick up 3 fruits from a basket of 10 fruits then what all ways are there to pick them up? Combinations is the answer to this question.
Let us say that I picked an Apple, a Banana and a Strawberry from the basket, then it really won't matter in what order I pi...

Read More
## Interleaving Strings

Problem Statement
This is a question from one of the interview experiences. The statement, "Given three strings A, B and C find if C is an interleaving of A and B." Interleaving is defined as below:
A string C is said to be an interleaving of two strings A and B if C contains a sub sequence of A and B such that the relative order of characters in A and in B are preserved in C.
For e.g. :
A - ABCD
B - BACDX
C - ABACDXBCD
The Idea - Interleaving Strings
Here I am not giving any solution which is less than O(M*N) solution where M is the length of the shortest string among A and B...

Read More
## Find Frequency In Sorted Array

Problem Statement
This is a question from one of the interview experiences. You are given a sorted array of numbers (this can be extended for arrays of characters, strings and what not) and a number K. Find the number of occurrences of K in the array.
Solution
Yes you got that right, it is really very simple. Walk through the array sequentially and if you get K then start counting till you get anything bigger than K. You can break out of the loop after this and the counter will tell you the obvious answer.
So, why am I even writing this post?
Because this is not fun, the above approach te...

Read More
## Adding numbers using Linked Lists

Introduction
Adding numbers has always been fascinating and you may think it to be the easiest mathematical operation possible. But believe me many a times that becomes the toughest problem to solve. Let us discuss this in more detail. It is really easy to add two numbers stored in two memory locations. The ALU provides you the option to use the ADD feature and store it on the DATA bus.
This is feasible when both the numbers can fit on the DATA bus one at a time. So, what about adding excessively large numbers, I know that the limit of BigInteger, Long, Double etc is too huge. But what if ...

Read More
## Reversing a Singly Linked List

Introduction
Many people have asked me to explain the dynamics of how the reversing of a singly linked list works, when we do not have the liberty of creating a new linked list, may be due to limitation of memory.
The Idea behind Reversing a Singly Linked List
The idea is to iterate through the complete linked list and maintain three pointers as listed below:
Pointer to the head of un reversed list headOfUnReversedLL.
Pointer to the head of reversed list headOfReversedLL.
Pointer to the node to be reversed nodeToReverse.
In each iteration we follow the below four steps:
The h...

Read More