01:198:111 Lecture 28: 12/10 - Final Exam Review
01:198:111 verified notes
28/28View all
Document Summary
Suppose an array is given with some invalid entries(indicated by -999). Write a program to remove the invalid entries and adjust the array while keeping the order of the entries that are valid, and add 0 to the end of the array that is unfilled. E. g. if you remove one -999 then there should be at least one 0 at the end of the array. Use an extra array of the same length. Copy over any element that is not -999 over into the new array. Any leftover elements would already be defaulted to 0 when you create it. Create a loop that edits the original array. Anytime the loop goes through the -999 it swaps the value with the next valid entry that is not -999. Then change the -999"s that at the end into. Write recursive function ispalindrome(char[] a) which takes an array of characters and return true if the characters represent a palindrome.