Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ListyString *listyCat(ListyString *listy, char *str); Description: Concatenate str to the end of the linked list string inside listy. If str is either NULL or the

ListyString *listyCat(ListyString *listy, char *str); Description: Concatenate str to the end of the linked list string inside listy. If str is either NULL or the empty string (), then listy should remain unchanged. Be sure to update the length member of listy as appropriate. Special Considerations: If listy is NULL and str is a non-empty string, then this function should create a new ListyString that represents the string str. If listy is NULL and str is NULL, this function should simply return NULL. If listy is NULL and str is a non-NULL empty string (), then this function should return a ListyString whose head member has been initialized to NULL and whose length member has been initialized to zero. Runtime Requirement: The runtime of this function must be no worse than O(n+m), where n is the length of listy and m is the length of str. Returns: If this function caused the creation of a new ListyString, return a pointer to that new ListyString. If one of the special considerations above requires that a NULL pointer be returned, then do so. Otherwise, return listy.

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;

ListyString *listyCat(ListyString *listy, char *str);

#endif

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 22nd International Conference Dexa 2011 Toulouse France August/September 2011 Proceedings Part 1 Lncs 6860

Authors: Abdelkader Hameurlain ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2011th Edition

3642230873, 978-3642230875

More Books

Students also viewed these Databases questions

Question

What are the major duties of your position? What exactly do you do?

Answered: 1 week ago

Question

a. Investment b. Equity in earnings

Answered: 1 week ago

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago