Assignment
QUESTIONS
1. Write a program that reads a line of text, changes each uppercase letter to the lowercase, and places in a queue and onto a stack. The program should then verify whether the line of text is a palindrome.
2. The eight queens puzzle is the problem of placing eight chess queens on an8×8 chessboard so that no two queens attack each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general n-queens problem of placing n queens on an ??×?? chessboard, where solutions exist for all natural numbers n with the exception of ??=2 and ??=3.
Write a program to find solutions to the n-queens puzzle for various valuesof n. To be specific, test your program for ?? = 4 and ?? = 8.
3. Write a program to find the number of comparisons using binarySearchand the sequential search algorithm as asked below. Suppose list is an array of 1000 elements:
Use a random number generator to fill list.
Use bubble sort algorithm to sort the list.
Search the list for some items as follows:
Use the binary search algorithm to search the list.
Use the binary search algorithm to search the list, switching to a sequential search when the size of the search list reduces to less than 15.