X
Write a Tutorial

Tutorials

A* Search Algorithm


18 April, 13 3

INTRODUCTION A is the most popular choice for pathfinding, because it’s fairly flexible and can be used in a wide range of contexts. A is like other graph-searching algorithms in that it can potentially search a huge area of the ...

Read more ...

Skew heaps


27 March, 13 0

Skew heaps, just as leftiest heaps are advantageous in implementing the melding operation of two heaps, its complexity is log n. #include<iostream> using namespace std; class node{ public: int key; node *rc; node *lc; node *parent; node(){ key=0; rc=NULL; lc=NULL; ...

Read more ...

Implementing leftist heaps


26 March, 13 0

Leftist Heap working code in C++ #include<iostream> using namespace std; class node{ public: int key; int rank; node *rc; node *lc; node *parent; node(){ key=0; rc=NULL; lc=NULL; parent=NULL; rank=cal_rank(rc); } int cal_rank(node *root){ node *temp; temp=root; int count=0; while(temp!=NULL){ temp=temp->rc; ...

Read more ...

Understanding Tree Traversing


23 March, 13 0

#include <iostream> using namespace std; struct node{ int val; node * right, * left; }; void main() { node *root; root = NULL; void Insert(node *root,const int& val) ; void InOrderTraversal(node *root); void preOrderTraversal(node *root); void PostOrderTraversal(node *root); int arr[10] ...

Read more ...

Name Mangling in C++


9 February, 13 0

Hi Everyone, As we know C++ is an object oriented language. One of the object oriented feature is polymorphism, and it is implemented using function overloading, operator overloading and virtual function. In this tutorial we will be talking about name ...

Read more ...

Boruvka's algorithm


6 February, 13 0

Boruvka's algorithm is an algorithm for finding a minimum spanning tree in a graph for which all edge weights are distinct. The algorithm begins by first examining each vertex and adding the cheapest edge from that vertex to another in ...

Read more ...

Stacking of boxes


23 January, 13 2

Problem Statement: You are given a set of n types of rectangular 3-D boxes, where the ith box has height h(i), width w(i) and depth d(i) (all real numbers). You want to create a stack of boxes which is as ...

Read more ...

Fibonnaci Sequence


21 January, 13 6

The Fibonacci Sequence is defined as a0 = 0, a1 = 1, and ai = ai - 1 + ai - 2 for all . The first few terms are: 0, 1, 1, 2, 3, 5, 8, 13, 21... Since ...

Read more ...

Check for duplicates in string


21 January, 13 1

Solution 1: Use two loops to check for duplicates. Complexity: O(n^2) Solution 2: We can use hash the characters and check if an element already exists. Complexity: O(n) Space complexity: O(256 characters) What about minimizing the space used above by ...

Read more ...

Binary Insertion Sort


16 January, 13 0

The article is an extension to the tutorial on insertion sort. http://learn.hackerearth.com/tutorial/sorting-algorithm/60/insertion-sort/ Combining binary search with insertion sort - Binary insertion sort Can we bring down the complexity of insertion sort to (N log N)? Observe that the cards in ...

Read more ...