Find minimum cost to travel to the destination railways station

There are N stations on a railway track. You are at the first station and you want to go to the final railway station. You […]

Recursive implementation of Insertion Sort

We discussed Insertion sort in detail earlier. This post shows the recursive implementation of Insertion Sort.

Print permutations of string replaced with digits

Given a string, print the variation of string as shown below Input String: ‘hat’ Replace one character with numeric one(‘1’): ‘1at‘, ‘h1t‘, ‘ha1‘ Replace two characters with […]

Non-recursive solution to tower of hanoi

We discussed problem of Tower of Hanoi earlier and written a recursive function to solve the problem, Recursive functions take lot of extra memory (New […]

Print array in the forward and backward direction recursively

Write a recursive function which will print an array in forward and backward order (depending on a parameter). The signature of the function should be […]

Recursive function to reverse a String

We have already seen the problem to reverse the words in a string, in the solution to that problem we have also written function to reverse […]

Recursive function to traverse linked list in reverse order

Write a recursive function to print the Linked list in reverse order …

Output of a recursive function

What will be the output of the below function if n is positive ?

Output of a C function

Given the following structure of Node of the Linked List: struct Node{ int data; Node *link; }; What is the purpose of the below function […]

Recursive function to reverse a linked list

Earlier I talked about Reversing a Singly linked list without using recursion. Today let’s write a recursive function to reverse a singly linked list.