Related questions
Hi, my name is Alex. This is an assignment that is due tonight at 11:59 pm. This assignment was supposed to be due next Friday, but my teacher changed the date at the last minute. I tried to get help from other sites and none have been able to help me. You are my last hope.
String as Singly Linked List
In many
In this assignment, you will implement a SLLString class using SLL. Your SLLString class will include the following members:
- SLLString(); //Default constructor
- SLLString(const string& other); //copy constructor taking a C++ string as parameter.
- ~SLLString(); // destructor.
- SLLString(const SLLString& other); //copy constructor taking another SLLString
- SLLString& operator=(const SLLString& other); // assignment constructor
- int length(); // get length of this string.
- SLLString& operator+= (const SLLString& other); // concatenation
- char& operator[](const int n); //get character at index n.
- int findSubstring(const SLLString& substring); // find the index of the first occurrence of substring in the current string. Returns -1 if not found.
- void erase(char c); //erase all occurrences of character c from the current string.
- support cout <<
- Node* head; // the head pointer to the SLL.
Each Node object should contain a char data type and a next pointer to Node.
Here are the sample usages:
int main(){
SLLString str("Hello world!");
SLLString newStr = new SLLString;
newStr = str;
newStr += SLLString(" CS@BC");
newStr[6] = ‘W’;
cout << newStr << endl; // Hello World! CS@BC
cout << newStr.length() << endl; //18
int loc = newStr.findSubstring("World");
cout << loc << endl; // 6
newStr.erase(‘l’); //erase the letter l.
cout << newStr << endl; // Heo Word! CS@BC
newStr.erase(‘C’);
cout << newStr << endl; // Heo Word! S@B
}
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
- T/F: All recursive algorithms are efficient due to its recursive property.arrow_forwardpublic List<String> getLikes(String user) This will take a String representing a user (like "Mike") and return a unique List containing all of the users that have liked the user "Mike." public List<String> getLikedBy(String user) This will take a String representing a user (like "Tony") and return a unique List containing each user that "Tony" has liked. create a Main to test your work. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.HashSet;import java.util.List;import java.util.Map;import java.util.Set; public class FacebookLikeManager { public List<String> facebookMap; private Set<String> likesSets; public FacebookLikeManager() { facebookMap = new ArrayList<>(); likesSets = new HashSet<>(Arrays.asList("Mike","Kristen","Bill","Sara")); } public void buildMap(String filePath) {...arrow_forwardLab Goal : This lab was designed to teach you more about list processing and algorithms.Lab Description : Write a program that will search a list to find the first odd number. If an odd number is found, then find the first even number following the odd number. Return the distance between the first odd number and the LAST even number. Return -1 if no odd numbers are found or there are no even numbers following an odd numberarrow_forward
- JAVA PROGRAM PLEASE MOFIFY THIS PROGRAM SO IT PRINTS OUT THE FOLLOWING TEST CASE: Enter a name to search or type QUIT to exit:\nAnnabelleENTERThe name 'Annabelle' was not found in either list.\nEnter a name to search or type QUIT to exit:\nxavierENTERThe name 'Xavier' was found in popular boy names list (line 81).\nEnter a name to search or type QUIT to exit:\nAMANDAENTERThe name 'Amanda' was found in popular girl names list (line 63).\nEnter a name to search or type QUIT to exit:\njOrdAnENTERThe name 'Jordan' was found in both lists: boy names (line 38) and girl names (line 75).\nEnter a name to search or type QUIT to exit:\nquitENTER IT HAS TO SAY Enter a name to search or type QUIT to exit:\n THEH I PUT THE NAME ANNABELLE THEN IT PRINTS OUT: The name 'Annabelle' was not found in either list.\n THEN IT REPEATS Enter a name to search or type QUIT to exit:\n THEN I PUT THE NAME xavier THEN IT PRINTS OUT: The name 'Xavier' was found in popular boy names list (line 81).\n AND SO ON....arrow_forwardJava - Normalizingarrow_forwardIN C++ Write code that: creates 3 integer values - one can be set to 0, the other two should NOT multiples of one another (for example 3 and 6, or 2 and 8) take you largest value and perform a modulus operation using the smaller (non zero) value as the divisor print out the result. create an alias for the string type call the alias "name" then create an instance of the "name" class and assign it a value using an appropriate cout statement - print out the value Please screenshot your input and output, as the format tends to get messed up. Thank you!arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education