The purpose of this assignment is to practice manipulating arrays. This assignment assesses your ability to: ▪Implement sequential and binary search algorithms for array structures. ▪Implement iterative sorting algorithms for array data. For this assignment, write a program that reads a text file and stores each word in an array. Write one of the iterative sorting algorithms to sort your data. Once the data is sorted, write a binary sort algorithm that, when given a string, returns either the index of the string or a -1 to indicate the string was not found in the array. Your program should allow the user to continually enter strings. An entry of 0 indicates the user is finished searching for strings. Start your program by reading strings from a file and populating a string array. Declare the array with a capacity for 10,000 strings. An input file is included with this assignment: ‘text.txt’. Next, write a method that implements either bubble sort, insertion sort, or selection sort. Write this implementation yourself without help from the Internet. Display the array before and after sorting it to ensure that the sort algorithm works properly. Remember, uppercase and lowercase letters affect the alphabetical ordering. Do not convert to all uppercase or all lowercase – just sort the words as they are presented. Finally, write a method that implements binary search on your sorted array. Allow the user to repeatedly enter words to search for. Display either the index of the word or a message that the word is not in the list. Before submitting your work, create a LOOM video in which you run your program and explain EXACTLY how your sort and search methods work. Focus on explaining WHY you coded your work the way you did. Refrain from reading your code; I can read code – what I want to know is whether or not you fully understand the work you have submitted. Your video should not exceed 4 minutes. Submit the following:

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 9PP
icon
Related questions
Question

CST-201

Project 0: Array Warm-Up
The purpose of this assignment is to practice manipulating arrays. This assignment assesses your ability to:
▪Implement sequential and binary search algorithms for array structures.
▪Implement iterative sorting algorithms for array data.
For this assignment, write a program that reads a text file and stores each word in an array. Write one of the iterative sorting algorithms to sort your data. Once the data is sorted, write a binary sort algorithm that, when given a string, returns either the index of the string or a -1 to indicate the string was not found in the array. Your program should allow the user to continually enter strings. An entry of 0 indicates the user is finished searching for strings.
Start your program by reading strings from a file and populating a string array. Declare the array with a capacity for 10,000 strings. An input file is included with this assignment: ‘text.txt’.
Next, write a method that implements either bubble sort, insertion sort, or selection sort. Write this implementation yourself without help from the Internet. Display the array before and after sorting it to ensure that the sort algorithm works properly. Remember, uppercase and lowercase letters affect the alphabetical ordering. Do not convert to all uppercase or all lowercase – just sort the words as they are presented.
Finally, write a method that implements binary search on your sorted array. Allow the user to repeatedly enter words to search for. Display either the index of the word or a message that the word is not in the list.
Before submitting your work, create a LOOM video in which you run your program and explain EXACTLY how your sort and search methods work. Focus on explaining WHY you coded your work the way you did. Refrain from reading your code; I can read code – what I want to know is whether or not you fully understand the work you have submitted. Your video should not exceed 4 minutes.
Submit the following:
1.Your program. Submit ONLY the files that you coded. If you have more than one file, zip them up before submitting. If you have only one file, add .txt to the extension and submit.
2.A text file called video.txt that contains a link to your LOOM video.
### Example of Java Sorting and Searching Program

This example demonstrates a simple Java application that reads a list of words from a file, sorts them, and then allows the user to search for words within the sorted list.

#### Input File
The program reads the input from the file, which contains the following line:
```
rest down from back that only take year door hand song blue
```

#### Program Execution Output

1. **Unsorted List**
   The initial unsorted list of words read from the file is:
   ```
   rest down from back that
   only take year door hand
   song blue
   ```

2. **Sorted List**
   After sorting, the list of words in alphabetical order is:
   ```
   back blue down from hand
   door only rest song take
   that year
   ```

3. **Word Search**
   The program then prompts users to enter words to search for within the sorted list. Below is the sample interaction from the program:
   - User inputs the word `rest`, and the program finds it in the list at index 7:
     ```
     rest
     rest is in the list at index 7
     ```
   - User inputs the word `test`, and the program indicates that the word is not in the list:
     ```
     test
     test is not in the list
     ```
   - User inputs `0` to exit the search:
     ```
     0
     Goodbye
     ```

The program showcases fundamental Java operations such as reading from a file, sorting a list, and searching within a list. This is a useful example for demonstrating basic text processing and algorithm implementation in Java.
Transcribed Image Text:### Example of Java Sorting and Searching Program This example demonstrates a simple Java application that reads a list of words from a file, sorts them, and then allows the user to search for words within the sorted list. #### Input File The program reads the input from the file, which contains the following line: ``` rest down from back that only take year door hand song blue ``` #### Program Execution Output 1. **Unsorted List** The initial unsorted list of words read from the file is: ``` rest down from back that only take year door hand song blue ``` 2. **Sorted List** After sorting, the list of words in alphabetical order is: ``` back blue down from hand door only rest song take that year ``` 3. **Word Search** The program then prompts users to enter words to search for within the sorted list. Below is the sample interaction from the program: - User inputs the word `rest`, and the program finds it in the list at index 7: ``` rest rest is in the list at index 7 ``` - User inputs the word `test`, and the program indicates that the word is not in the list: ``` test test is not in the list ``` - User inputs `0` to exit the search: ``` 0 Goodbye ``` The program showcases fundamental Java operations such as reading from a file, sorting a list, and searching within a list. This is a useful example for demonstrating basic text processing and algorithm implementation in Java.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Quicksort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr