palindrome algorithm

Now I tried to explain about palindromes, what is palindrome? palindrome meaning that if the words read from left to right or right to left the same. 'RADAR', is one example of the word palindrome because in reading from left to right or right to left the same result 'RADAR'. When viewed it looks easy for us who have long involved with the world of information technology. But I will explain how the algorithm and implementation using C programming language of this palindrome with the steps as follows:


  • First declare a variable containing an array A 'RADAR' and the array B to serve as a comparison when the array A has been moved to an array B with transfers made from A [n-1] and will use a variable bolean 'x' for the outcome of whether ' RADAR 'said palindrome or not
  • Then after that, first print array containing a 'RADAR' to check whether the declaration is correct that you have previously made
 
  • Furthermore, the logic of the palindrome is actually just move the array A into array B with the launch of A [n-1] like this
 Hint: J is the variable which is declaration at the beginning with the value 0(see point 1)
  •  To prove whether the process points 3 that true, then please print first array B
  • Now it is time to checking that array B has the same contents with array A and if equal then the 'x' will is true and if one letter is not the same 'x'  become false value then the process is stopped
  • This is the last step to the process of palindromes. Check if all the contents of an array of B matches the array A if match so that's palindrome if not that's not palindrome


This is the code i've made before : palindrome

0 comments

Posting Komentar