## Min Heap implementation for Dijkstra algorithm

Dijkstra’s algorithm is used to compute the shortest distance between two vertices in a graph. The psuedo code for the main part of Dijkstra’s algorithm is shown below:

An extremely fast implementation for Heap which can be used in Dijkstra’s algorithm is shown below:

MinHeap implements two methods (at a minimum): Insert. Extract Min. For Dijkstra’s algorithm, it[…]

## Detecting applications which cause Page faults

Over the weekend, I ran an algorithm (All Pair Shortest Path) using Bellman Ford which has a running time of O(n2m). Since the 20,000 node graph was dense, the algorithm ran for four hours with a CPU load of 100% on quad-core processor. I noticed a significant degradation in performance (prior to getting a good algorithm) due to Page faults[…]

## Debugging a class library in a web application

Debugging a class library in a web application is pretty simple. But, this is something that can be tricky when you are joining a new organization or project. If you do not know how to debug a class library in a web application, here are the steps: Enable debugging on the web application. Deploy a debug version of the class[…]

## MinHeap implementation for .NET

A heap is a balanced tree which has some special properties. There are two variations of heap: MinHeap and MaxHeap. MinHeap has the property where the parent node is lesser than all the child nodes. In a MinHeap, the root node has the minimum value. MaxHeap is the opposite of MinHeap. MaxHeap has the maximum value in the root node.[…]

## Getting all documents from a FAST collection

The Introduction to FAST Search API provides an introduction on how to use the FAST API. The following code explains how to get all documents from a FAST collection.

When a search query is sent to FAST, FAST prepares a result set with a maximum of 4020 documents. By passing in two query parameters: offset and hits, it is possible[…]

## QuickSelect works in linear time

QuickSelect is a selection algorithm that finds the kth smallest number from a list. QuickSelect is O(n) algorithm. I built a simple prototype to verify that QuickSelect works in linear time. QuickSelect uses a random pivot to partition the array. The items to the left of the pivot are lesser than the pivot. The items to the right of the pivot[…]

## Javascript inheritance in Knockout ViewModels

Knockout is an elegant way of updating the user interface using Javascript View models. Javascript has an inheritance model which allows for a View model hierarchy. As an illustration, consider the following HTML:

The name and detail properties of the View model are bound to the respective div elements. The Javascript which applies the binding is shown below:

[…]

## Getting all collections stored in FAST

FAST has something called Views. Views encapsulate how content is structured, how search is performed, and how results are presented. Content is organized using Collections. A collection is a grouping of FAST Documents. Each FAST Document has a specific structure, specified by Fields. The view also stores the profile based on which documents are indexed. Search is performed depending on[…]

## Ensure that the Task gets completed before exiting the Unit Test method

There are methods that return a Task<T>. While testing such methods, a common mistake is to make assert statements, without waiting for the task to complete.

While I wrote a few test methods like the above, all those test methods succeeded repeatedly. I was doing integration testing and I expected the test methods to fail. It was a while[…]