Question
void reverseListyString(ListyString *listy); Description: Reverse the linked list contained within listy. Be careful to guard against segfaults in the cases where listy is NULL or
void reverseListyString(ListyString *listy); Description: Reverse the linked list contained within listy. Be careful to guard against segfaults in the cases where listy is NULL or listy->head is NULL. Runtime Consideration: Ideally, this function should be O(n), where n is the length of the ListyString. Note that if you repeatedly remove the head of listys linked list and insert it at the tail of a new linked list using a slow tail insertion function, that could devolve into an O(n2) approach to solving this problem. Returns: Nothing. This is a void function.
Inside H file:
#ifndef __LISTY_STRING_H
#define __LISTY_STRING_H
typedef struct ListyNode
{
char data;
struct ListyNode *next;
} ListyNode;
typedef struct ListyString
{
ListyNode *head;
int length;
} ListyString;
int processInputFile(char *filename);
ListyString *createListyString(char *str);
ListyString *destroyListyString(ListyString *listy);
ListyString *cloneListyString(ListyString *listy);
void replaceChar(ListyString *listy, char key, char *str);
void reverseListyString(ListyString *listy);
ListyString *listyCat(ListyString *listy, char *str);
int listyCmp(ListyString *listy1, ListyString *listy2);
int listyLength(ListyString *listy);
void printListyString(ListyString *listy);
double difficultyRating(void);
double hoursSpent(void);
#endif
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started