Write a program called compute in Java that reads a text file, in.txt, that contains a list of positive integers (duplicates are possible, zero is not considered a positive integer) separated by spaces and/or line breaks. After reading the integers, the program must recursively figure out if the list of integers includes two equal integers. If the list includes two equal integers, the program prints out Yes. Otherwise, the program prints out No. Assume that in.txt contains at least 2 integers. It is important that your program be named Two and that the input file is named in.txt. Examples: • If in.txt contains 8,8 the program must print out Yes. • If in.txt contains 5 3 3 4, the program must print out Yes. • If in.txt contains 11 3 5 11, the program must print out Yes. • If in.txt contains 1 2 3 4 5 6 10, the program must print out No. • If in.txt contains 24 14 11 4 6, the program must print out No. Program Specification The program must solve the problem using a recursive algorithm without modifying the linked list. Although the program requirements specified below might seem contrived an unnecessarily restrictive, their only purpose is to guide you in the right direction and to prevent you from taking a wrong step. The solution, we are looking for is very short and simple. Your program has to: (a) Implement a linked list. You are supposed to implement the linked list from scratch without using language libraries. For example, you are not allowed to use any built-in dynamic data structures,               such as ArrayList or LinkedList. Each node of the linked list must include only two elements: an integer and a reference to the next element from the list. There is no need to provide a full-fledged implementation of linked list. Keep your linked list implementation minimal and implement as much as you need to solve the problem. (b) Read the integers from the file in.txt and store them into the linked list in the same order in which they appear in the input file. No calculations are allowed at this step; the program must only read the input numbers and store them into the linked list. (c) Work on the linked list in order to find out if the list includes two equal integers. All computations must be done in place on the original linked list. In other words, your program can use only one data structure (and only one instance of it), the linked list, some auxiliary scalar variables and reference variables (used to point to different nodes of the list). No additional data structures are allowed, such as a second linked list, an array, string, etc. The only exception is I/O where you can use strings to read in.txt. You can use standard I/O libraries to perform I/O. For example, you can use StringTokenizer or Scanner. This is the only place you can use strings and libraries. No data structures are allowed (with the exception of string used to read in.txt). If (d) Print Yes or No.

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...
icon
Related questions
Question
Write a program called compute in Java that reads a text file, in.txt, that contains a list of positive integers
(duplicates are possible, zero is not considered a positive integer) separated by spaces and/or line breaks.
After reading the integers, the program must recursively figure out if the list of integers includes two
equal integers. If the list includes two equal integers, the program prints out Yes. Otherwise, the program
prints out No. Assume that in.txt contains at least 2 integers. It is important that your program be named
Two and that the input file is named in.txt.

Examples:
• If in.txt contains 8,8 the program must print out Yes.
• If in.txt contains 5 3 3 4, the program must print out Yes.
• If in.txt contains 11 3 5 11, the program must print out Yes.
• If in.txt contains 1 2 3 4 5 6 10, the program must print out No.
• If in.txt contains 24 14 11 4 6, the program must print out No.


Program Specification

The program must solve the problem using a recursive algorithm without modifying the linked
list. Although the program requirements specified below might seem contrived an unnecessarily
restrictive, their only purpose is to guide you in the right direction and to prevent you from
taking a wrong step. The solution, we are looking for is very short and simple.

Your program has to:
(a) Implement a linked list.
You are supposed to implement the linked list from scratch without using language
libraries. For example, you are not allowed to use any built-in dynamic data structures,
 
 
 
 
 
 
 
such as ArrayList or LinkedList. Each node of the linked list must include only two
elements: an integer and a reference to the next element from the list.
There is no need to provide a full-fledged implementation of linked list. Keep your linked
list implementation minimal and implement as much as you need to solve the problem.
(b) Read the integers from the file in.txt and store them into the linked list in the same order
in which they appear in the input file. No calculations are allowed at this step; the
program must only read the input numbers and store them into the linked list.
(c) Work on the linked list in order to find out if the list includes two equal integers. All
computations must be done in place on the original linked list. In other words, your
program can use only one data structure (and only one instance of it), the linked list,
some auxiliary scalar variables and reference variables (used to point to different nodes
of the list). No additional data structures are allowed, such as a second linked list, an
array, string, etc. The only exception is I/O where you can use strings to read in.txt. You
can use standard I/O libraries to perform I/O. For example, you can use StringTokenizer
or Scanner. This is the only place you can use strings and libraries. No data structures are
allowed (with the exception of string used to read in.txt). If
(d) Print Yes or No.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY