b. Add a class member function which outputs if the linked list in Problem a. is a palindrome. What is the Big-O upper bound? c. What change could be made to the class definition in Problem a. to make your solution in Problem b. more efficient? Explain. What is the Big-O upper bound? Hint: Think of how the palindrome determination problem is solved for a regular string.

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
B and C
All the problems are to be coded in Python/Java. You must explicitly solve each problem
below using your own logic. For example, Do not use existing library functions, such as sum(
), which computes the sum of a list. Instead, you must use for/while loop to sum up the items
in a list.
a. Write code for a CharList class which converts a string to a linked list of characters in the
string.
b. Add a class member function which outputs if the linked list in Problem a. is a palindrome.
What is the Big-O upper bound?
c. What change could be made to the class definition in Problem a. to make your solution in
Problem b. more efficient? Explain. What is the Big-O upper bound? Hint: Think of how
the palindrome determination problem is solved for a regular string.
d. Add a method to the classic List class we discussed in class that reverses the list. That is,
if the original list is A -> B ->C, all of the list's links should change so that C-> B-> A.
Make your solution as efficient as possible. You may modify the List class to fit your needs.
e. Let's say you have access to a node from somewhere in the middle of a classic linked list,
but not the linked list itself (the head node is not available). That is, you have a variable
that points to an instance of Node, but you don't have access to the LinkedList instance. In
this situation, if you follow this node's link, you can find all the items from this middle
node until the end, but you have no way to find the nodes that precede this node in the list.
Write code that will effectively delete this node from the list. The entire remaining list
should remain complete, with only this node removed.
70°F M.
Transcribed Image Text:All the problems are to be coded in Python/Java. You must explicitly solve each problem below using your own logic. For example, Do not use existing library functions, such as sum( ), which computes the sum of a list. Instead, you must use for/while loop to sum up the items in a list. a. Write code for a CharList class which converts a string to a linked list of characters in the string. b. Add a class member function which outputs if the linked list in Problem a. is a palindrome. What is the Big-O upper bound? c. What change could be made to the class definition in Problem a. to make your solution in Problem b. more efficient? Explain. What is the Big-O upper bound? Hint: Think of how the palindrome determination problem is solved for a regular string. d. Add a method to the classic List class we discussed in class that reverses the list. That is, if the original list is A -> B ->C, all of the list's links should change so that C-> B-> A. Make your solution as efficient as possible. You may modify the List class to fit your needs. e. Let's say you have access to a node from somewhere in the middle of a classic linked list, but not the linked list itself (the head node is not available). That is, you have a variable that points to an instance of Node, but you don't have access to the LinkedList instance. In this situation, if you follow this node's link, you can find all the items from this middle node until the end, but you have no way to find the nodes that precede this node in the list. Write code that will effectively delete this node from the list. The entire remaining list should remain complete, with only this node removed. 70°F M.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

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