Quicksort

Quicksort is a sorting algorithm which applies divide and conquer paradigm. Quicksort has a worst case running time of , however, it has running time of on average which makes quicksort very efficient. Moreover, it works in-place but not stable. The performance of quicksort depends on selecting the pivot, and starting to partition around it. […]

Selection Sort

Selection sort is an in-place comparison sort algorithm which has running time complexity in both best and worst case. Even though its logic is similar to insertion sort, it’s a very inefficient sorting algorithm. List is both divided into two parts as sorted and unsorted where initially sorted part is empty. Every turn, algorithm finds […]

Merge Sort

Merge sort is another comparison based sort algorithm. It closely follows divide-and-conquer paradigm, and provides run time complexity in worst and average cases, however, in space complexity. Merge sort can be used for sorting huge data sets that can not fit into memory. It is also a stable sort which preserves the order of equal […]

Binary Search

Binary search is a searching algorithm which works on a sorted (ascending or descending) array. In each turn, the given key is compared with the key at the middle of the array, if it is equal to it then its index is returned. Otherwise, if the given key is less than key at the middle […]

Heaps

The binary heap data structure is an array object that represents a nearly complete binary tree. Thus, each element of the array corresponds to a node of the tree. Heaps are useful data structures for heapsort ,and they are underlying data structure of priority queues. So for simplicity we can say priority queue is a […]

Binary Search Trees

A Binary Search Tree (BST) is a tree data structure that supports many dynamic operations includes ; Search Minimum Maximum Insert Delete Predecessor Successor Basic operations in a binary search tree take time proportional to to the height of the tree. For a complete binary tree with n nodes, such operations run in worst-case time. […]

Insertion Sort

Insertion sort is an efficient algorithm for sorting a small number of elements, however, it is less efficient on large lists than more advanced sorting algorithms. On the other hand, it has several advantages which are; It is adaptive; Sorting performance adapts to the initial order of elements. It is online; New elements can be […]

Bubble Sort

Bubble sort is one of the simplest sorting algorithm which pairs are repeatedly compared and swapped if they are in wrong order. This process continues until no swaps are needed means that list is sorted. It takes its name from the fact that necessary elements bubble up to their correct position. Even though bubble sort […]

Jersey Client Example with JSON Support

In this tutorial we will implement a Jersey client example with JSON support. The tools and technologies that I have used are; Eclipse 4.3.0 JBoss AS 7.1.1.Final Maven 3.1.1 JDK 1.7 Project Structure Our project structure will look like below; Dependencies There are two dependencies to use Jersey client and JSON support

jersey-client dependency […]

mongoexport query with using date

Sometimes we might want to export only a specific part of our collection with query support of mongoexport. Suppose this is our notebook collection, and each document refers to a notebook with their production date.

The original way of mongoexport is defined by

The major problem is we can not use ISODate(“”) objects […]