Skip to content

Category Archives: Sorting

  Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as… Read More
Given two lists sorted in increasing order, create and return a new list representing the intersection of the two lists. The new list should be… Read More
  Question: Write an efficient program for printing k largest elements in an array. Elements in array can be in any order.For example, if given… Read More
You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array.… Read More
  Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted, then… Read More
Print the elements of an array in the decreasing frequency if 2 numbers have same frequency then print the one which came first.  Examples:   Input:… Read More