CODES
some learning from problems.
CODES
some learning from problems.
Showing posts with label
Recursion
.
Show all posts
Showing posts with label
Recursion
.
Show all posts
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(...
Wednesday, 4 July 2012
WAP to return all anagrams from the array of strings. (all possible permutation of a String)
›
#include<stdio.h> #include<string.h> int anagram(char S[10],int l,char C[10]) { char D[10]; int j,k,m=strlen(C),i; ...
The character 'a' to 'z' are encoded as 1 - 26. Given a string of digits, compute the number of valid decodings of the string. For example, both 'aa' and 'k' can be encoded as '11'. Hence num_valid_encodings('11') = 2.
›
recursive #include <stdio.h> #include <string.h> int count_decode(char S[10],int n) { int x1=S[n-1]-'0',x2...
2 comments:
›
Home
View web version