0% found this document useful (0 votes)
6 views1 page

String Manipulation Algorithms

The document outlines four programming tasks: reversing vowels in a string, finding the longest substring without repeating characters, detecting cycles in a singly linked list, and calculating character frequency in a string. Each task includes example inputs and expected outputs. The tasks focus on string manipulation and data structure operations.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

String Manipulation Algorithms

The document outlines four programming tasks: reversing vowels in a string, finding the longest substring without repeating characters, detecting cycles in a singly linked list, and calculating character frequency in a string. Each task includes example inputs and expected outputs. The tasks focus on string manipulation and data structure operations.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

1.

Write a program that takes a string as input and reverses only the vowels in the

𝐈𝐧𝐩𝐮𝐭: "programming"
string, while keeping all other characters in their original positions.

𝐎𝐮𝐭𝐩𝐮𝐭: "prigrammong"

2. Write a function to determine the length of the longest substring in a given

𝐈𝐧𝐩𝐮𝐭: "dvdf"
string that contains no repeating characters.

𝐎𝐮𝐭𝐩𝐮𝐭: 3

𝐈𝐧𝐩𝐮𝐭: 1 -> 2 -> 3 -> 4 -> 5 -> 2 (cycle back to node 2)


3. Write a function to detect if a cycle exists in a given singly linked list.

𝐎𝐮𝐭𝐩𝐮𝐭: true

4. Write a program to calculate the frequency of each character in a given string

𝐈𝐧𝐩𝐮𝐭: "aabbcc"
and display the results.

𝐎𝐮𝐭𝐩𝐮𝐭: {'a': 2, 'b': 2, 'c': 2}

You might also like