Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A word is said to be “abecedarian” if the letters in the word appear in alphabet

ID: 3714870 • Letter: A

Question

A word is said to be “abecedarian” if the letters in the word appear in alphabetical order. For example, the following are all 6-letter English abecedarian words. abdest, acknow, acorsy, adempt, adipsy, agnosy, befist, behint, beknow, bijoux, biopsy, cestuy, chintz, deflux, dehors, dehort, deinos, diluvy, dimpsy
a. Describe an algorithm for checking whether a given word (String) is abecedarian, assuming that the word contains only lower-case letters. Your algorithm can be iterative or recursive.
b. Implement your algorithm in a function called IsAbecedarian(). Both questions written in C, Both parts must be tested within full programs. (Not necessarily together) A word is said to be “abecedarian” if the letters in the word appear in alphabetical order. For example, the following are all 6-letter English abecedarian words. abdest, acknow, acorsy, adempt, adipsy, agnosy, befist, behint, beknow, bijoux, biopsy, cestuy, chintz, deflux, dehors, dehort, deinos, diluvy, dimpsy
a. Describe an algorithm for checking whether a given word (String) is abecedarian, assuming that the word contains only lower-case letters. Your algorithm can be iterative or recursive.
b. Implement your algorithm in a function called IsAbecedarian(). Both questions written in C, Both parts must be tested within full programs. (Not necessarily together) A word is said to be “abecedarian” if the letters in the word appear in alphabetical order. For example, the following are all 6-letter English abecedarian words. abdest, acknow, acorsy, adempt, adipsy, agnosy, befist, behint, beknow, bijoux, biopsy, cestuy, chintz, deflux, dehors, dehort, deinos, diluvy, dimpsy
a. Describe an algorithm for checking whether a given word (String) is abecedarian, assuming that the word contains only lower-case letters. Your algorithm can be iterative or recursive.
b. Implement your algorithm in a function called IsAbecedarian(). Both questions written in C, Both parts must be tested within full programs. (Not necessarily together)

Explanation / Answer

This can be done by the simple logic.

//algorithm

abecedarian(){

int flag=0;

for(length of the word){

if (previous letter in the word is bigger compared to present letter)

flag=1;

}

if(flag==1){

print("not abecedarian");

}

else{

print(" abecedarian");

}

}

//c program

#include<stdio.h>

#include<string.h>

int main(){

int flag=0;

//assuming that string length less than 50

char str[50];

printf("Enter a string:");

gets(str);

int i=1;

while(str[i]!=''){

if(str[i]<str[i-1]){

flag=1;

break;

}

i++;

}

if(flag==1){

printf("The given string is not abecedarian");

}

else{

printf("The given string is abecedarian");

}

return 0;

}

Note: Please enter valid string.

hope this helps...

Thankyou... :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote