DSA Data Structures Array String Linked List Stack Queue Tree Binary Tree Binary Sea
String in Data Structure
In data structures, a string is a sequence of characters used to
represent text. Strings are commonly used for storing and
manipulating textual data in computer programs. They can be
manipulated using various operations like concatenation, substring
extraction, and comparison.
String in Data Structure
Table of Content
What is a String?
String Data Type
String Operations
Applications of String
Basics of Strings
String in different language
We useBasic
cookiesOperations of the
to ensure you have String
best browsing experience on our website. By using our site, you
acknowledge
Binary Stringthat you have read and understood our Cookie Policy & Privacy Policy
Substring & Subsequence Got It !
Pattern Searching
Problems on Palindrome String
Easy Problems on String
Medium Problems on String
Hard Problems on String
What is a String?
String is considered a data type in general and is typically represented
as arrays of bytes (or words) that store a sequence of characters.
String is defined as an array of characters. The difference between a
character array and a string is the string is terminated with a special
character ‘\0’. Some examples of strings are: “geeks” , “for”, “geeks”,
“GeeksforGeeks”, “Geeks for Geeks”, “123Geeks”, “@123 Geeks”.
String Data Type:
In most programming languages, strings are treated as a distinct data
type. This means that strings have their own set of operations and
properties. They can be declared and manipulated using specific
string-related functions and methods.
Note: In some languages, strings are implemented as arrays of
characters, making them a derived data type.
String Operations:
Strings support a wide range of operations, including concatenation,
substring extraction, length calculation, and more. These operations
allow developers to manipulate and process string data efficiently.
Below are fundamental operations commonly performed on strings in
programming.
Concatenation: Combining two strings to create a new string.
Length: Determining the number of characters in a string.
Access: Accessing individual characters in a string by index.
Substring: Extracting a portion of a string.
Comparison: Comparing two strings to check for equality or order.
Search: Finding the position of a specific substring within a string.
Modification: Changing or replacing characters within a string.
Applications of String:
Text Processing: Strings are extensively used for text processing
tasks such as searching, manipulating, and analyzing textual data.
Data Representation: Strings are fundamental for representing and
manipulating data in formats like JSON, XML, and CSV.
Encryption and Hashing: Strings are commonly used in encryption
and hashing algorithms to secure sensitive data and ensure data
integrity.
Database Operations: Strings are essential for working with
databases, including storing and querying text-based data.
Web Development: Strings are utilized in web development for
constructing URLs, handling form data, processing input from web
forms, and generating dynamic content.
Basics of Strings:
Introduction to Strings – Data Structure and Algorithm Tutorials
Applications, Advantages and Disadvantages of String
Storage for Strings in C
String in different language:
Strings in C
String Class in C++
String Class in Java
Python String
C# | String
JavaScript String
PHP | Strings
Basic Operations of String:
Searching For Characters and Substring in a String
Program to reverse a string (Iterative and Recursive)
Left Rotation and Right Rotation of a String
Sort string of characters
Print the frequency of each character in Alphabetical order
Swap characters in a String
C program to find the length of a string
How to insert characters in a string at a certain position?
Program to check if two strings are same or not
Concatenating Two Strings
Remove all occurrences of a character in a string
Binary String:
Change if all bits can be made same by single flip
Number of flips to make binary string alternate
Binary representation of next number
Min flips of continuous characters to make all characters same in a
string
Generate all binary strings without consecutive 1’s
Find i’th Index character in a binary string obtained after n iterations
Generate n-bit Gray Codes
Substring & Subsequence:
Program to print all substrings of a given string
Print all subsequences of a string
Count Distinct Subsequences
Count distinct occurrences as a subsequence
Longest Common Subsequence
Shortest Superstring Problem
Printing Shortest Common Supersequence
Shortest Common Supersequence
Longest Repeating Subsequence
Longest Palindromic Subsequence
Longest Palindromic Substring using Dynamic Programming
Pattern Searching:
Naive algorithm for Pattern Searching
KMP Algorithm for Pattern Searching
Z algorithm
Search a Word in a 2D Grid of characters
Wildcard Pattern Matching
Aho-Corasick Algorithm
Find all strings that match specific pattern in a dictionary
Check if string follows order of characters defined by a pattern or
not
Problems on Palindrome String:
C Program to Check if a Given String is Palindrome
Check if a given string is a rotation of a palindrome
Check if characters of a given string can be rearranged to form a
palindrome
Online algorithm for checking palindrome in a stream
Print all palindromic partitions of a string
Minimum characters to be added at front to make string palindrome
Make largest palindrome by changing at most K-digits
Minimum number of deletions to make a string palindrome
Minimum insertions to form a palindrome with permutations
allowed
Easy Problems on String:
Count strings with consecutive 1’s
Generate all binary strings from given pattern
Add n binary strings
Divide large number represented as string
Program to find Smallest and Largest Word in a String
Count number of equal pairs in a string
Camel case of a given sentence
Second most repeated word in a sequence
Print all possible strings that can be made by placing spaces
Check if all levels of two trees are anagrams or not
Medium Problems on String:
K’th Non-repeating Character
Queries for characters in a repeated string
URLify a given string (Replace spaces is %20)
Count of total anagram substrings
Count number of binary strings without consecutive 1’s
Lexicographically next string
Check if given string can be split into four distinct strings
Word Break Problem
Check for balanced parentheses in an expression | O(1) space
Length of Longest Balanced Subsequence
Minimum Swaps for Bracket Balancing
Convert a sentence into its equivalent mobile numeric keypad
sequence
Burrows – Wheeler Data Transform Algorithm
Form minimum number from given sequence
Print shortest path to print a string on screen
Mirror characters of a string
Hard Problems on String:
Multiply Large Numbers represented as Strings
Count ways to increase LCS length of two strings by one
Minimum rotations required to get the same string
Find if an array of strings can be chained to form a circle
Given a sorted dictionary of an alien language, find order of
characters
Remove minimum number of characters so that two strings become
anagram
Minimum Number of Manipulations required to make two Strings
Anagram Without Deletion of Character
Palindrome Substring Queries
Powet Set in Lexicographic order
Minimum Word Break
Minimum number of bracket reversals needed to make an
expression balanced
Word Wrap problem ( Space optimized solution )
Decode a string recursively encoded as count followed by substring
"The DSA course helped me a lot in clearing the interview rounds. It
was really very helpful in setting a strong foundation for my problem-
solving skills. Really a great investment, the passion Sandeep sir has
towards DSA/teaching is what made the huge difference." - Gaurav |
Placed at Amazon
Before you move on to the world of development, master the
fundamentals of DSA on which every advanced algorithm is built
upon. Choose your preferred language and start learning today:
DSA In JAVA/C++
DSA In Python
DSA In JavaScript
Trusted by Millions, Taught by One- Join the best DSA Course Today!
Recommended Problems
Solve Problems
Frequently asked DSA Problems
Last Updated : 01 Apr, 2024 1
Next
Introduction to Strings - Data
Structure and Algorithm Tutorials
Share your thoughts in the comments Add Your Comment
Similar Reads
Static Data Structure vs Dynamic Data Structure
Is array a Data Type or Data Structure?
Data Structure Alignment : How data is arranged and accessed in Computer
Memory?
Difference between data type and data structure
Efficiently check if a string has all unique characters without using any
additional data structure
Ropes Data Structure (Fast String Concatenation)
Efficiently find first repeated character in a string without using any additional
data structure in one traversal
Applications of Queue Data Structure
Data Structure for a single resource reservations
A data structure for n elements and O(1) operations
H harendra…
Article Tags : DSA , Strings
Practice Tags : Strings
Trending in News View More
10 Best Todoist Alternatives in 2024 (Free)
How to Get Spotify Premium Free Forever on iOS/Android
Yahoo Acquires Instagram Co-Founders' AI News Platform Artifact
OpenAI Introduces DALL-E Editor Interface
Top 10 R Project Ideas for Beginners in 2024
A-143, 9th Floor, Sovereign Corporate
Tower, Sector-136, Noida, Uttar Pradesh -
201305
Company Explore
About Us Hack-A-Thons
Legal GfG Weekly Contest
Careers DSA in JAVA/C++
In Media Master System Design
Contact Us Master CP
Advertise with us GeeksforGeeks Videos
GFG Corporate Solution Geeks Community
Placement Training Program
Languages DSA
Python Data Structures
Java Algorithms
C++ DSA for Beginners
PHP Basic DSA Problems
GoLang DSA Roadmap
SQL Top 100 DSA Interview Problems
R Language DSA Roadmap by Sandeep Jain
Android Tutorial All Cheat Sheets
Tutorials Archive
Data Science & ML HTML & CSS
Data Science With Python HTML
Data Science For Beginner CSS
Machine Learning Tutorial Web Templates
ML Maths CSS Frameworks
Data Visualisation Tutorial Bootstrap
Pandas Tutorial Tailwind CSS
NumPy Tutorial SASS
NLP Tutorial LESS
Deep Learning Tutorial Web Design
Django Tutorial
Python Tutorial Computer Science
Python Programming Examples Operating Systems
Python Projects Computer Network
Python Tkinter Database Management System
Web Scraping Software Engineering
OpenCV Tutorial Digital Logic Design
Python Interview Question Engineering Maths
DevOps Competitive Programming
Git Top DS or Algo for CP
AWS Top 50 Tree
Docker Top 50 Graph
Kubernetes Top 50 Array
Azure Top 50 String
GCP Top 50 DP
DevOps Roadmap Top 15 Websites for CP
System Design JavaScript
High Level Design JavaScript Examples
Low Level Design TypeScript
UML Diagrams ReactJS
Interview Guide NextJS
Design Patterns AngularJS
OOAD NodeJS
System Design Bootcamp Lodash
Interview Questions Web Browser
Preparation Corner School Subjects
Company-Wise Recruitment Process Mathematics
Resume Templates Physics
Aptitude Preparation Chemistry
Puzzles Biology
Company-Wise Preparation Social Science
English Grammar
World GK
Management & Finance Free Online Tools
Management Typing Test
HR Management Image Editor
Finance Code Formatters
Income Tax Code Converters
Organisational Behaviour Currency Converter
Marketing Random Number Generator
Random Password Generator
More Tutorials GeeksforGeeks Videos
Software Development DSA
Software Testing Python
Product Management Java
SAP C++
SEO - Search Engine Optimization Data Science
Linux CS Subjects
Excel
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved