Quicksort in any programming language is an algorithm for sorting data sequences. It is typically implemented as follows (example demonstrates a quicksort of an array of type int). Note that a half-open range, [begin:end), includes the one-past-the-end of the range and is the conventional means of defining a range of contiguous array values. When begin==end, the range is deemed empty. // forward declarations void qsort (int* unsigned); // this is the function you will actually invoke void qsort_rec (int*, int*); // recursive function int* partition (int*, int*); // utility functions... int* select_pivot (int*, int*); void swap (int*, int*); int count (int*, int*); // sort a data sequence of length size void qsort (int* data, unsigned size) { qsort_rec (data, data + size); } // recursively sort the half-open range [begin:end) void qsort_rec (int* begin, int* end) { if (count (begin, end) < 2) return; // end point of recursion int* pivot = partition (begin, end); qsort_rec (begin, pivot); qsort_rec (++pivot, end); } // divide the half-open range [begin:end) into two around a pivot value int* partition (int* begin, int* end) { if (count (begin, end) < 2) return begin; int* pivot = select_pivot (begin, end); swap (begin, pivot); --end; while (begin != end) { while (*(begin) <= *pivot && begin != end) ++begin; while (*pivot < *(end) && begin != end) --end; if (begin!=end) swap (begin, end); } assert (begin==end); // sanity check! swap (pivot, begin); return begin; } // select the median of three from a half-open range [begin:end) int* select_pivot (int* begin, int* end) { int* mid = begin + (count (begin, end) / 2); if (*end<*begin) swap (begin, end); if (*mid<*begin) swap (begin, mid); if (*end<*mid) swap (mid, end); return end; } // swap the values referred to by p and q void swap (int* p, int* q) { if (!p !q) return; // sanity check! int t = *p; *p = *q; *q = t; } // count the elements in the half-closed range [begin:end) int count (int* begin, int* end) { int cnt = 0; int add; if (begin>end) { // swap pointers if the range is reversed int* t = begin; begin = end; end = t; add = -1; // count will be negative } else { add = 1; // count will be positive } while (begin++!=end) cnt+=add; return cnt; }
class R { public static void main(String args[]) { String s="vikrant"; String s3=""; char ch[]=s.toCharArray(); char s1=ch[0]; char s2=ch[0]; for(int i=ch.length-2;i>=1;i--) s3+=ch[i]; System.out.println(s1+s3+s2); } } for more: kumar976001@gmail.com
/*Input: Enter the String: AHFJFJ * Enter the gap : 2 *Output: CJHLHL */ import java.io.*; class Crypt { protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the String: "); String s=in.readLine(),s1=""; System.out.print("Enter the Gap: "); short g=Short.parseShort(in.readLine()); for(short i=0;i<s.length();i++) { char ch=s.charAt(i); if(Character.isUpperCase(ch)) { ch+=g; if(ch>'Z') ch-=26; else if(ch<'A') ch+=26; s1+=ch; } else if(Character.isLowerCase(ch)) { ch+=g; if(ch<'a') ch+=26; else if(ch>'z') ch-=26; s1+=ch; } else if(Character.isDigit(ch)) { ch+=g; if(j>'9') j-=10; else if(j<'0') j+=10; s1+=ch; } else s1+=ch; } System.out.print("String: "+s1); }}
The XOR operator is the carat character: ^Example:// Create characterchar ch = 'a';System.out.println(ch);// Perform XORch = (char)(ch ^ 86);System.out.println(ch);// Perform XOR...againch = (char)(ch ^ 86);System.out.println(ch);
#include <string.h> char * revsentence(char *str) { int i,j,len; char temp; len=0; len=strlen(str) for(i=0;j=len-1;i<j;i++,j--) { temp=str[i]; str[j]=str[i]; str[j]=temp; } return str; }
which
Charge, chase and choose are action words. They begin with the letters CH.
church , children , childish
Cheap, checkers, cheers and check start with the letters CH. Additional words that begin with CH are chain, chair and chalet.
Numerous words begin with the letters CH. A few of the words are chain, chair, chairman, chalet, chalk, chamber, champ, change, chapel, chaplain, channel, change, charity, charm, chat and chauffer.
Rich, Snitch, Hitch...
The phrase 'big words' is rather broad. Here are some examples:approachattachbatchbeachbelchbeseechbirchbitchbleachblowtorchbotchbreachbreechbrunchbunchbutterscotchcatchchurchcinchclutchcoachcockroachcornstarchcouchcrotchcrouchcrunchcrutchdebauchdispatchditchdrenchdutchencroacheunuchfetchflinchfrenchglitchhatchhitchhomestretchhunchhutchkeypunchlatchleechlunchlurchmarchmatchmatriarchmonarchmoochmulchmunchnonesuchnotchoutreachpatchpatriarchpeachperchpinchpitchpoachporchpouchpreachpunchreachreproachresearchsandwichscorchscotchscratchscrunchsketchslouchsnatchsnitchspeechstretchswatchswitchteachtorchtouchtwitchvouchwatchwenchwhichwitchworkbenchwrenchwretchwristwatchzilch
Inch
· chico (small)
Some words that begin with S and end with W are:sallowSawscarecrowscowscrewseesawsewshowshrewsowspewswallow
Church, crunch, lunch, bunch, punch
Ranch, french, bench