In the context of designing a system that offers a file management capability, e.g., OneDrive, there are some constraints on the acceptable file names. The following three characters {*,$, :} in addition to spaces are not allowed in file names. If any of these four characters appears in a file name, it is replaced by a hyphen (-). Examples: "new file" → "new-file" "important$file" → "important-file" "abcdefghijklm.txt" → "abc-def-gh-ij-klm.txt" "exam.doc" → "exam.doc" i. Design an algorithm that takes a file name as a string and returns a modified name replacing the prohibited characters with hyphens. Use pseudocode to describe your algorithm. Define all operations that are used in your algorithm. ii. What is the runtime complexity of your algorithm?

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 3E
icon
Related questions
Question
(5.1) In the context of designing a system that offers a file management capability, e.g.,
OneDrive, there are some constraints on the acceptable file names. The following
three characters {*,$, :} in addition to spaces are not allowed in file names. If any
of these four characters appears in a file name, it is replaced by a hyphen (-).
Examples:
"new file" → "new-file"
"important$file" → "important-file"
"abc$def gh:ij*klm.txt" → "abc-def-gh-ij-klm.txt"
"exam.doc" →→ "exam.doc"
i. Design an algorithm that takes a file name as a string and returns a modified
name replacing the prohibited characters with hyphens. Use pseudocode to
describe your algorithm. Define all operations that are used in your algorithm.
ii. What is the runtime complexity of your algorithm?
Transcribed Image Text:(5.1) In the context of designing a system that offers a file management capability, e.g., OneDrive, there are some constraints on the acceptable file names. The following three characters {*,$, :} in addition to spaces are not allowed in file names. If any of these four characters appears in a file name, it is replaced by a hyphen (-). Examples: "new file" → "new-file" "important$file" → "important-file" "abc$def gh:ij*klm.txt" → "abc-def-gh-ij-klm.txt" "exam.doc" →→ "exam.doc" i. Design an algorithm that takes a file name as a string and returns a modified name replacing the prohibited characters with hyphens. Use pseudocode to describe your algorithm. Define all operations that are used in your algorithm. ii. What is the runtime complexity of your algorithm?
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr