Thursday, 26 January 2017

Selection Sort

Selection Sort (adsbygoogle = window.adsbygoogle || []).push({}); Selection sort is a simple sorting algorithm. This sorting algorithm is an in-place comparison-based algorithm in which the list is divided into two parts, the sorted part at the left end and the unsorted part at the right...

Tuesday, 11 October 2016

Count Number Of Duplicates Elements Present In Array

Count Number Of Duplicates Elements Present In Array You need to count Number of duplicates elements present in an array that occurs two or more times. For Example:  Input: arr = 1,2,3,1,1,2,4,5,2,3 Output :      3  (1 present 3 times, 2 present 3 times , 3 present...

Friday, 7 October 2016

Delete All Node From A Link List Greater Than A Given Value(X)

Delete All Node From Link List Greater Than A Given Value Linked-List Program: void DeleteNode(node** head, int x) {     node *ptr = *head;     node *prev,*temp,*temp1;     if((*head== NULL))     {         printf("\n\nlist...

Monday, 3 October 2016

A Program to check if strings are rotations of each other or not

A Program to check if strings are rotations of each other or not String-Rotations #include <iostream> #include <cstring> #include<string> using namespace std; void CompareString(string, string, int); int ComputeLength(string str); int main() { string str = ""; string...

Sunday, 2 October 2016

Interview Question #1

What happens if you Call a free on a pointer twice? Deallocating a memory area with free does not make the contents of the pointer NULL.  Suppose that you have int *a = malloc (sizeof (int)) and a has 0xdeadbeef and you execute free (a) then after execution a still contains 0xdeadbeef but...

Calculate Sum Of All Numbers Present In String

Calculate sum of all numbers present in a string sum-of-all-digits-present-in-a-string #include <iostream> #include<stdio.h> #include<string.h> using namespace std; int SumOfDigits(string str, int n); int SumOfoverallNumberPresent_In_Sequence(string str, int n); int...

Tuesday, 20 September 2016