1/26/2024 0 Comments Linked list stackNote: the empty string is a palindrome, as is every string of length one.įor this homework, you should make the function more flexible than the version you wrote for the earlier lab. For example, "madam", "dad", and "abba" are palindromes. A palindrome is a string that is identical to itself when reversed. Return true if text is a palindrome, false otherwise. Here is the signature and documentation for the function which is declared in hw3.c: As a reminder, this function implements simple palindome verification. Use a stack and queue (using the dynarray_t structure) to implement a more powerful version of the is_palindrome() function from an earlier lab. NOTE: For the purposes of this lab, you may use this function as if it accepts and returns a char. If no conversion is possible, the value returned is unchanged. In addition, you may find the following function from ctype.h useful:Ĭonverts c to its lowercase equivalent. Size_t dynarray_is_empty(dynarray_t *a) // return true if empty /* Stack operations */ void dynarray_push(dynarray_t *a, data_t item) // add to backĭata_t dynarray_pop (dynarray_t *a) // remove from backĭata_t dynarray_top (dynarray_t *a) // return back /* Queue operations */ void dynarray_enqueue(dynarray_t *a, data_t item) // add to backĭata_t dynarray_dequeue(dynarray_t *a) // remove from frontĭata_t dynarray_front (dynarray_t *a) // return front Size_t dynarray_size (dynarray_t *a) // return element count Typedef dynarray_t // dynamic array struct /* Basic/common operations */ void dynarray_init (dynarray_t *a) // initialize struct void dynarray_free (dynarray_t *a) // free struct
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |