Monthly Archives: February 2017

Write a Java Program to perform Quick Sort using Static Function

Java Program to perform Quick Sort Quicksort is a divide and conquer algorithm. In a divide and conquer sorting algorithm the original data is separated into two parts “divide” which are individually sorted and “conquered” and then combined. If the array contains only one element or zero elements than the array is sorted. If the… Read More »

Write a Java Program to perform Selection Sort using static function

Java Program to perform Selection Sort Selection sort is a sorting algorithm which sorts the given array elements either in descending or ascending order by finding the misplaced element first and putting it in it’s final place. Selection sort algorithm first selects the lowest (or highest) element and places it in the ordered position. Selection… Read More »

Write a C++ Program for Splitting the Choco Bars Problem

C++ Program for Splitting the Choco Bars   Dholu and Bholu are given chocolate bars which are rectangular shaped.Each chocolate is given a label A, B and C. The chocolate is to be splitted into exactly two pieces in a manner such that: The piece that Dholu has can not contain any chocolate with name… Read More »

Find the probability of getting a 1-bit number ?

Find the probability of getting a 1–bit number ? Find the probability of getting a 1-bit number after the following procedure is followed: Initially a number x is chosen at random in a given range .After this we again choose a bit from x randomly? Find the expected number of bit 1s if we randomly… Read More »