Recursive function to traverse linked list in reverse order

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

Number of inversions in an Array.

Write a function which will accept an array and count the number of inversions in the array. Inversions in an Array are a measure of […]

Making both elements of an array zero

Given an Array of two elements one of which is 0, the other is either 0 or 1. You have to make both the elements […]

Run Length Encoding

What is “Run Length Encoding (RLE)” ? Write a function, which will accept a string and convert it to a Run Length Encoded string.

Memory Efficient doubly linked list

Implement doubly linked list which has only one pointer (may not be directly of apointer data type) per node.

Freeing memory allocated to n-dim array using free

Yesterday we learned about how to allocate memory on heap for an n-dim array using Malloc. Today let us see how to deallocate the memory […]

How to swap 2 variables witout using third

The usual method of swapping two numbers, using a temporaty variable is as shown below. // Swapping 2 int, X & Y using temporary variable […]

Allocating memory to n-dim Array on heap

Dynamic arrays are on heap. If an array is stored on heap, its address must be stored in pointer variables, else there will be no […]

k'th Node from End

Given a linked list and a positive integer k, write a function which will return value of k’th node from the end of list. If […]

Divide & Conquer Approach to find a^n

If you want to compute a^n ( a raised to the power n), then the algorithm is simple: long power(int a, int n) { long […]