Write an algorithm that receives a string and reverses it.
Answers were Sorted based on User's Feedback
Answer / sreejesh1987
step 1:Declare the variables needed.
step 2: Get the String in a String variable
step 2:Use a for loop to reverse the string.
step 3:Display the elements of the string from last element
to first element.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / sudip chatterjee
1. Start.
2. Declare Array str1[25], str2[25] as an alphanumeric.
3. Declare i, g, l, as numeric.
4. Assign or accept value to Str1.
5. l=i=0;
6. while(str1[i]!="/0")["/0"last index point that u entered.]
a.increase i, l by 1;
7. Repeat steps i,ii, iii for j from o
i. str2[j]= str1[i-1]
ii. increase j by 1.
iii. decrease i by 1.
8. str2[j]="/0" .
9. Display str2
10. Exit.
Is This Answer Correct ? | 2 Yes | 0 No |
Complexity T(n) What is the time complexity T(n) of the following portions of code? For simplicity, you may assume that n is a power of 2. That is, n = 2k for some positive integer k. a) ? for (i = 1; i <= n; i++) { j = n; cout << i << ? ? j << ? ? << endl; } b) ? for (i = 0; i <= n; i += 2) { j = n; cout << i << ? ? j << ? ? << endl; } c) ? for (i = n; i >= 1; i = i/2) { j = n; cout << i << ? ? j << ? ? << endl; } d) for (i = 1; i <= n; i++) { j = n; while (j >= 0) { cout << i << ? ? j << ? ? << endl; j = j - 2; } }
We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character
a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.. ""EXAMPLE"" enter how many numbers to be inputted: 5 12 14 11 09 30 what number to search: 11 11 IS FOUND IN LOCATION 3 PLZZZ.. ELP ME...
Seat Reservation prog for the theatre. Write a function for seat allocation for the movie tickets. Total no of seats available are 200. 20 in each row. Each row is referred by the Character, "A" for the first row and 'J' for the last. And each seat in a row is represented by the no. 1-20. So seat in diffrent rows would be represented as A1,A2....;B1,B2.....;........J1,J2... Each cell in the table represent either 0 or 1. 0 rep would seat is available , 1 would represent seat is reserved. Booking should start from the last row (J) to the first row(A). At the max 20 seats can be booked at a time. if seats are available, then print all the seat nos like "B2" i.e (2 row, 3 col) otherwise Print "Seats are not available." and we must book consecutive seats only.
Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …
Show by induction that 2n > n2, for all n > 4.
2 Answers Karvy, Qatar University,
Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37
How to swap two ASCII numbers?
write a program that accepts a number and outputs its equivalent in words. take note that the maximum input is 3000
1. Write a program using one dimensional array that calculates the sum and average of the five input values from the keyboard and prints the calculated sum and average.
Write a program using one dimensional array that accept five values from the keyboard. Then it should also accept a number to search. This number is to be searched if it among the five input values. If it is found, display the message “Search number is found!” otherwise, display “Search is lost”. Example: Enter 5 numbers: 10 15 20 7 8 Enter number to search: 7 Search number is found!
2 Answers College School Exams Tests,
Code for Method of Handling Factorials of Any Size?