Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The answer that you have posted is not the same as this request, as follow you are provided with three files. You only need to

The answer that you have posted is not the same as this request, as follow

you are provided with three files. You only need to make changes to one file. The others includes important instructions. Please review all provided files.

main.c - a collection of tests. You may not change this file

stringTools.h - prototypes for the functions assigned on the homework. You may not change this file. You must match the provided prototypes.

stringTools.c - the function definitions. You must implement the functions defined here. This is also where you will put your analysis.

Please help with this homework in c program I included all files below

Instructions The goal of this assignment is to understand the runtime and memory usage of common commands. You are provided with an incomplete C program. It uses five string functions. These are functions that are built into almost every high level language. You are going to implement them yourself. Then you are going to determine the runtime and memory usage of each function. The primary goal of this assignment is to understand that as programmers it is important to know what built in tools do. The runtime of code we write is dependent on the code we use. If you dont have an idea of what that code is doing, you cannot estimate the complexity of your algorithms. Provided Code You are provided with three files. You only need to make changes to one file. The others includes important instructions. Please review all provided files. main.c - a collection of tests. You may not change this file stringTools.h - prototypes for the functions assigned on the homework. You may not change this file. You must match the provided prototypes. stringTools.c - the function definitions. You must implement the functions defined here. This is also where you will put your analysis. Replit will compile automatically. If you want to compile it manually the command would be: gcc -o main main.c stringTools.c Then you would excute it by typing ./main Note that you only list the c files and not the h files in the compile command. Functions The functions you are doing to define are described in stringTools.h. This is just a summary. int length(char* str); - Determine the length of the string char* upper(char* str); - Convert all characters in str to uppercase int find(char* str, char target); - Find the position of the first appearance of target in str char* replace(char* str, char oldChar, char newChar); - Replace all appearances of oldChar with newChar in str bool lessThan(char* str1, char* str2); - Determine str1

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

main.c > ... main.c + hw2_students(1) > hw2_students > C main.c > ... hw2_students(1) > hw2_students >C main.c > main.c + hw2_students(1) > hw2_students > C main.c > ... hw2_students(1) > hw2_students > C main.c > hw2_students(1) > hw2_students > C main.c > ... hw2_students(1) > hw2_students > C main.c > ... (** afile @author Your Name adate The Date asection Description This is the only file you need to change. Answer all homework questions in this file. See other files and homework instructions for information. Once you write a function, you may use it to answer later questions. */ // You may only use these three libraries \#include "stdbool.h" \#include "stdio.h" \#include "stdlib.h" \#* Once you have implemented the function answer these questions about it. Memory Usage: Complete this memory usage for your function once you have implemented it. Function Inputs: ? bytes Return Value: ? byes Local Variables: ? bytes Heap Space Requested: ? bytes Runtime: Complete this table with the operations you used. Assume the string has n characters not including the null terminator for your counts. If there are two strings, assume the LONGER string has n characters and the SHORTER string has m characters. stringTools.c + stringTools.c > ... Once you have implemented the function answer these questions about it. Memory Usage: Complete this memory usage for your function once you have implemented it. Function Inputs: ? bytes Return Value: ? byes Local Variables: ? bytes Heap Space Requested: ? bytes Runtime: Complete this table with the operations you used. Assume the string has n characters not including the null terminator for your counts. If there are two strings, assume the LONGER string has n characters and the SHORTER string has m characters. int find(char *str, char target) \{ // Implement Me return 2; \} / Once you have implemented the function answer these questions about it. Memory Usage: Complete this memory usage for your function once you have implemented it. Function Inputs: ? bytes Return Value: ? byes Tools.c > ... Local Variables: ? bytes Heap Space Requested: ? bytes Runtime: Complete this table with the operations you used. Assume the string has n characters not including the null terminator for your counts. If there are two strings, assume the LONGER string has n characters and the SHORTER string has m characters. char *replace(char str, char oldChar, char newChar) \{ // Implement Me return NULL; 3 / Once you have implemented the function answer these questions about it. Memory Usage: Complete this memory usage for your function once you have implemented it. Function Inputs: ? bytes Return Value: ? byes Local Variables: ? bytes Heap Space Requested: ? bytes Runtime: Complete this table with the operations you used. Assume the string has n characters not including the null terminator for your counts. If there are two strings, assume the LONGER string has n characters and the SHORTER string has m characters. (asection Description This file defines 5 common string tools. They are features that are built into most programming languages. You will implement using the basic features of the C language. The goal of this homework is to see what is actually happening when you use the built in version of these tools in other languages. Some of these are even included in string.h which comes with C. You are not allowed to use this library. The only libraries you may include are stdio.h, stdbool.h, and stdlib.h. If you need anything not in those two libraries, you need to build it yourself. */ \#ifndef _STRING_TOOLS_H_ \#define _STRING_TOOLS_H_ // We are using bool true/false // So, we need this library \#include "stdbool.h" //-n-_--YOU MAY NOT CHANGE THIS FILE- / Compute the length of a string. We know all strings are NULL Terminated. That means they end with a null 0 character. The length of a string is the number of characters not including the null terminator. In Python, this would be "size = len(someString)" In Java, this would be 'size = somestring. length( )" The function takes one input, a pointer to an array of characters. It returns the number of characters in the string. aparam str is a pointer to the character array areturn the number of characters stringTools.h + stringTools.h > ... tringTools.h >

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_2

Step: 3

blur-text-image_3

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 Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Explain the process of MBO

Answered: 1 week ago

Question

Know how to find a consultant

Answered: 1 week ago