String reverse with time complexity of n/2 with out using
temporary variable.
Answer Posted / manish pathak
//********this is perfect answer***************
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,num,rem,l;
char s[]="abcde";
l=sizeof(s)-1;
for(i=0,j=l-1;i<=(l-1)/2;i++)//save space n/2
{
s[i]=s[i]+s[j-i];
s[j-i]=s[i]-s[j-i];
s[i]=s[i]-s[j-i];
}
s[l]='\0';
printf("%s",s);
getch();
}
Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines
What is data _null_? ,Explain with code when u need to use it in data step programming ?
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
write a simple calculator c program to perform addition, subtraction, mul and div.
Sir... please give some important coding questions asked by product companies..
Design an implement of the inputs functions for event mode
How can you relate the function with the structure? Explain with an appropriate example.
Write a routine to implement the polymarker function
Develop a routine to reflect an object about an arbitrarily selected plane
#include
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
write a program for area of circumference of shapes