CODES
some learning from problems.
CODES
some learning from problems.
Showing posts with label
Array
.
Show all posts
Showing posts with label
Array
.
Show all posts
Tuesday, 2 October 2012
Re-arrange the odd/even to odd/even places
›
Given an array of integers [3,1,4,5,7,6,10,8], re arrange elements such that either even numbers in even locations or odd numbers in ...
2 comments:
Friday, 14 September 2012
Sort an Array of 0 1& 2 in one pass
›
G iven an array int a[] = {0, 1, 1 ,0, 2, 2, 1, 0 ,1, 2, 1,0 } to be converted into {0, 0, 0, 0, 1, 1, 1, 1, 1 ,2 ,2 ,2} inplace a...
Saturday, 7 July 2012
To copy the contents of an array A to contents of Array B without using loops and any standard string copy functions.
›
#include<stdio.h> int Copy_Array(int A[],int B[], int n,int i) { if(i==n) return 0; B[i]=A[i]; Copy_Array(...
Friday, 6 July 2012
Find duplicates in O(n) time and O(1) extra space
›
Given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these...
3 comments:
Kahan We Met
›
Geet is travelling to meet her boyfriend in Mumbai. Aditya is travelling to Mumbai for his business meeting. Geet starts from Delh...
1 comment:
Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?
›
INPUT > OUTPUT INPUT > > OUTPUT 4 4 ...
3 comments:
Reduce aabcccccaaa to a2b1c5a3 for new string is of smaller size otherwise live it original
›
#include<stdio.h> #include<string.h> int main() { char s[20],o[20],temp; int i=0,j=0,c=0; gets(s); ...
Write a method to decide if two strings are premutation of each other or not.
›
#include<stdio.h> #include<string.h> int check_permutation(char s1[], char s2[]) { int c[27],i; for(i=0;i<27;i...
Implement an algorithm to determine if a string has all unique characters.
›
#include<stdio.h> #include<string.h> int main() { char input[27]; int i,l,check[28]; scanf("%s",...
Wednesday, 4 July 2012
sort an array a[n] containing 0s and 1s with time complexity n and you cant use more than 1 data structure
›
// TIME: O(n) || Space : O(1) #include<stdio.h> int main() { int A[20],i,j,n,temp; printf("Enter n :"...
›
Home
View web version