The attached file, CommonFemaleNames.txt, contains the top 1000 female names in the United States. The format is integer string where the integer is the popularity number (1 is most popular) and string is a female first name. The program is to read the list of names and create an array of objects. It then sorts the array in alphabetical order. The user enters a name, which the program searches for and then reports how common that name is. The program is to use two different search algorithms, a linear search and a binary search. It reports on how many microseconds it takes to find the name using each method. Requirements 1. Each name and popularity number must be stored in a separate object. 2. The names on the list are all uppercase, but the program must find the name even if it is entered in lower case. Do this by converting
The attached file, CommonFemaleNames.txt, contains the top 1000 female names in the United States. The format is integer string where the integer is the popularity number (1 is most popular) and string is a female first name. The program is to read the list of names and create an array of objects. It then sorts the array in alphabetical order. The user enters a name, which the program searches for and then reports how common that name is. The program is to use two different search algorithms, a linear search and a binary search. It reports on how many microseconds it takes to find the name using each method. Requirements 1. Each name and popularity number must be stored in a separate object. 2. The names on the list are all uppercase, but the program must find the name even if it is entered in lower case. Do this by converting
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
The attached file, CommonFemaleNames.txt, contains the top 1000 female names in the United States. The
format is integer string where the integer is the popularity number (1 is most popular) and string is a female
first name. The program is to read the list of names and create an array of objects. It then sorts the array in
alphabetical order. The user enters a name, which the program searches for and then reports how common
that name is. The program is to use two different search algorithms , a linear search and a binary search. It
reports on how many microseconds it takes to find the name using each method.
Requirements
1. Each name and popularity number must be stored in a separate object.
2. The names on the list are all uppercase, but the program must find the name even if it is entered in
lower case. Do this by converting the entered name to all caps.
3. It must give an appropriate message if the name entered is not on the list.
4. Both a linear and a binary search are required, for each name entered and the time it takes for each
one reported.
5. Either the sort or the binary search must use a recursive method (Hint: a recursive binary search is
easier than a recursive sort)
Note: It works best if namePair is an array of pointers to
CommonName (My UML creator won’t let me show that)
Extra Credit
• Use quicksort to sort the name objects (5 points)
• Throw an exception when a name is not found. Handle it in the calling procedure (5 points)
![Name
- namePair: CommonName []
- nextname: int
+ Name()
+ addName(pair: CommonName): void
+ sortNames(): void
+ findLinear(name: string): int
+ findBinary(name: string): int
- findRecursive(name: string, low: int, high: int): void
Note: It works best if namePair is an array of pointers to
CommonName (My UML creator won't let me show that).
CommonName
- ordinal: int
- name: string
+ CommonName(ord: int, aName: string)
+ getOrdinal(): int
+ getName(): string](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47577806-debe-455c-b0cc-e7afa6e96ab3%2F016406e7-6b1e-4ec2-a11e-86fce84b48e4%2F1npv49i_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Name
- namePair: CommonName []
- nextname: int
+ Name()
+ addName(pair: CommonName): void
+ sortNames(): void
+ findLinear(name: string): int
+ findBinary(name: string): int
- findRecursive(name: string, low: int, high: int): void
Note: It works best if namePair is an array of pointers to
CommonName (My UML creator won't let me show that).
CommonName
- ordinal: int
- name: string
+ CommonName(ord: int, aName: string)
+ getOrdinal(): int
+ getName(): string
![Sample Output
C:4.
C:\Windows\system32\cmd.ex
The names have been read
The names have been sorted
Enter a female name, enter STOP to end: Pauline
Linear search took 3662 microseconds
Binary search took 118 microseconds
PAULIÑE is the number 133 most popular female name
Enter a female name, enter STOP to end: Kathyrn
KATHYRN is not on the list
Enter a female name, enter STOP to end: Jennifer
Linear search took 2222 microseconds
Binary search took 133 microseconds
JENNIFER is the number 6 most popular female name
Enter a female name, enter STOP to end: stop
Press any key to continue](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47577806-debe-455c-b0cc-e7afa6e96ab3%2F016406e7-6b1e-4ec2-a11e-86fce84b48e4%2Fg18rdp9_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Sample Output
C:4.
C:\Windows\system32\cmd.ex
The names have been read
The names have been sorted
Enter a female name, enter STOP to end: Pauline
Linear search took 3662 microseconds
Binary search took 118 microseconds
PAULIÑE is the number 133 most popular female name
Enter a female name, enter STOP to end: Kathyrn
KATHYRN is not on the list
Enter a female name, enter STOP to end: Jennifer
Linear search took 2222 microseconds
Binary search took 133 microseconds
JENNIFER is the number 6 most popular female name
Enter a female name, enter STOP to end: stop
Press any key to continue
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 8 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY