Write a program which generates randomly some numbers (integer) say 20 numbers
between 1 and 100 and send it to an output file called randOutput.txt. Next your program
should open this file (randOutput.txt) and check whether the numbers are ordered either
ascending (or descending) or not. So you should have a ‘Check function’ which returns 1
if it is ordered in ascending order, 0 if it is not ordered and -1 if it is ordered in
descending order.
If it is not sorted your program should make use of ‘linear search’ to look for three
numbers (Key1, key2 & key3) in the list. You can either ask the user to enter these keys
at the command line or you can read them from another input file (inputKeys.txt).
Next your program should sort the list using ‘bubble sort’ and display the ordered list
both on screen and to an output file (orderedList.txt).
Finally the program should implement a ‘binary search’ to look for three keys mentioned
above after the list has been sorted.
The keys can be sent separately one by one through the search algorithm or as array
parameters to a ‘search function’.
Sahilroy -7 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.