SlideShare a Scribd company logo
3
Most read
11
Most read
12
Most read
String Operation
Csc-391
2
Data Structures and Algorithms
Remarks
• Each programming language contains a character
set that is used to communicate with the
computer. This set usually includes the
followings-
• Alphabet- A B C D… X Y Z
• Digits- 0 1 2.. 9
• Special Characters- + - / * . (), {}, , $ etc..
©SMT, Faculty, CSE, IUBAT
3
Data Structures and Algorithms
Storing String
• For Example,
©SMT, Faculty, CSE, IUBAT
4
Data Structures and Algorithms
Storing String
• 1. Fixed- length storage.
©SMT, Faculty, CSE, IUBAT
5
Data Structures and Algorithms
Storing String
• 1. Fixed- length storage.
©SMT, Faculty, CSE, IUBAT
6
Data Structures and Algorithms
Storing String
• 2. Variable- length storage with fixed maximum.
©SMT, Faculty, CSE, IUBAT
7
Data Structures and Algorithms
Storing String
• 2. Variable- length storage with fixed maximum.
©SMT, Faculty, CSE, IUBAT
8
Data Structures and Algorithms
Storing String
• 3. Linked storage
©SMT, Faculty, CSE, IUBAT
9
Data Structures and Algorithms
String Operation
• Length: LENGTH (string)
e.g.- LENGTH(‘Mark Zuckerberg’)= 15
• Substring: SUBSTRING(string, initial, length)
e.g.- SUBSTRING(‘Impossible is a word found in coward’s dictionary’,0,20) =
Impossible is a word
• Indexing: INDEX(string, pattern)
e.g.- INDEX(‘He is wearing glasses’, ‘ear’)= 8
• Concatenation: String1//String2
e.g.- ‘To be or not to be’// ‘, this is the question.’= To be or not to be, this is the
question
©SMT, Faculty, CSE, IUBAT
©SMT, Faculty, CSE, IUBAT
String Operation
• Word Processing-
Insertion: INSERT(string, position, string)
e.g.- INSERT(‘ABCDEIJKL’,5,‘FGH’)=
ABCDEFGHIJKL
Deletion: DELETE(string, position, length)
e.g.- DELETE(‘ABCDEFG’, 4, 2)= ABCDG
11
Data Structures and Algorithms
String Operation
– Replacement: REPLACE(string, pattern1, pattern2)
e.g.- REPLACE(‘XABYABZ’, ‘AB’, ‘c’)= XCYABZ
REPLACE function can be executed be using the following three steps-
1. K:= INDEX(string, P1)
2. T:= DELETE(string, K, LENGTH(P1))
3. INSERT(T, K, P1)
– So, the algorithm is-
©SMT, Faculty, CSE, IUBAT
12
Data Structures and Algorithms
String Operation
– Pattern Matching:
Pattern matching is the problem of deciding whether or not a given string pattern
P appears in a text.
Widely used in word processing.
– So, a basic algorithm is-
©SMT, Faculty, CSE, IUBAT

More Related Content

PPT
Top down parsing
PPTX
Pushdown Automata Theory
PPT
Chapter 5 Syntax Directed Translation
PPTX
Asymptotic Notation
PPTX
Top down parsing
PDF
COMPILER DESIGN- Syntax Directed Translation
PPT
PPT
1.Role lexical Analyzer
Top down parsing
Pushdown Automata Theory
Chapter 5 Syntax Directed Translation
Asymptotic Notation
Top down parsing
COMPILER DESIGN- Syntax Directed Translation
1.Role lexical Analyzer

What's hot (20)

PDF
Syntax analysis
PDF
Intermediate code generation in Compiler Design
PPTX
Multi processor scheduling
PPT
Divide and conquer
PPTX
Lexical analyzer generator lex
PDF
Formal Languages and Automata Theory Unit 1
PPT
02. chapter 3 lexical analysis
PPTX
Types of grammer - TOC
PPSX
Data Structure (Queue)
PPT
Algorithm analysis
PPTX
Lecture 14 run time environment
PPTX
Linked list
PPTX
Control Strategies in AI
PPTX
Resolution method in AI.pptx
PPTX
Introduction TO Finite Automata
PPTX
stack & queue
PPT
Data Structure and Algorithms
PPTX
Compiler design syntax analysis
PDF
PPTX
NFA & DFA
Syntax analysis
Intermediate code generation in Compiler Design
Multi processor scheduling
Divide and conquer
Lexical analyzer generator lex
Formal Languages and Automata Theory Unit 1
02. chapter 3 lexical analysis
Types of grammer - TOC
Data Structure (Queue)
Algorithm analysis
Lecture 14 run time environment
Linked list
Control Strategies in AI
Resolution method in AI.pptx
Introduction TO Finite Automata
stack & queue
Data Structure and Algorithms
Compiler design syntax analysis
NFA & DFA
Ad

Similar to String operation (20)

PPTX
Different string operations....................
PPTX
VCE - UNIT-II.pptx
PPT
Data Structures: Introduction_______.ppt
PPT
DSA___________________SSSSSSSSSSSSSS.ppt
PPT
Introduction to Data Structure and Algorithms
DOCX
Lab Manual Data Structure and Algorithm.docx
PPTX
Strings
PPTX
data types.pptx
PDF
Dfs analysis
PDF
Chapter 4 (Part II) - Array and Strings.pdf
PPT
Data Structures
PPTX
Data Structure.pptx
PPTX
Algorithm and Data Structures - Basic of IT Problem Solving
PPTX
report 26.pptx
DOCX
Data structure and algorithm.
PDF
Data Structure Introduction.pdfssssssssssss
PPTX
PPTX
Data Structure and Algorithms
PDF
Data Structure Basics
Different string operations....................
VCE - UNIT-II.pptx
Data Structures: Introduction_______.ppt
DSA___________________SSSSSSSSSSSSSS.ppt
Introduction to Data Structure and Algorithms
Lab Manual Data Structure and Algorithm.docx
Strings
data types.pptx
Dfs analysis
Chapter 4 (Part II) - Array and Strings.pdf
Data Structures
Data Structure.pptx
Algorithm and Data Structures - Basic of IT Problem Solving
report 26.pptx
Data structure and algorithm.
Data Structure Introduction.pdfssssssssssss
Data Structure and Algorithms
Data Structure Basics
Ad

More from Shakila Mahjabin (14)

PPTX
Computer processing
PPTX
Arrays in CPP
DOCX
CSC 433 Sample normalization SQL Question
PPT
SQL : introduction
PPT
Normalization
PDF
Solution of Erds
PPT
Entity Relationship Diagram
PPT
Ch1- Introduction to dbms
PPTX
Stack and queue
PPTX
Algo analysis
PPTX
Merge sort and quick sort
PDF
Codes on structures
PDF
PDF
array, function, pointer, pattern matching
Computer processing
Arrays in CPP
CSC 433 Sample normalization SQL Question
SQL : introduction
Normalization
Solution of Erds
Entity Relationship Diagram
Ch1- Introduction to dbms
Stack and queue
Algo analysis
Merge sort and quick sort
Codes on structures
array, function, pointer, pattern matching

Recently uploaded (20)

PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Cell Structure & Organelles in detailed.
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
From loneliness to social connection charting
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
English Language Teaching from Post-.pdf
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Renaissance Architecture: A Journey from Faith to Humanism
Cell Structure & Organelles in detailed.
Revamp in MTO Odoo 18 Inventory - Odoo Slides
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
O5-L3 Freight Transport Ops (International) V1.pdf
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
O7-L3 Supply Chain Operations - ICLT Program
Abdominal Access Techniques with Prof. Dr. R K Mishra
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
From loneliness to social connection charting
How to Manage Starshipit in Odoo 18 - Odoo Slides
Cardiovascular Pharmacology for pharmacy students.pptx
English Language Teaching from Post-.pdf
NOI Hackathon - Summer Edition - GreenThumber.pptx

String operation

  • 2. 2 Data Structures and Algorithms Remarks • Each programming language contains a character set that is used to communicate with the computer. This set usually includes the followings- • Alphabet- A B C D… X Y Z • Digits- 0 1 2.. 9 • Special Characters- + - / * . (), {}, , $ etc.. ©SMT, Faculty, CSE, IUBAT
  • 3. 3 Data Structures and Algorithms Storing String • For Example, ©SMT, Faculty, CSE, IUBAT
  • 4. 4 Data Structures and Algorithms Storing String • 1. Fixed- length storage. ©SMT, Faculty, CSE, IUBAT
  • 5. 5 Data Structures and Algorithms Storing String • 1. Fixed- length storage. ©SMT, Faculty, CSE, IUBAT
  • 6. 6 Data Structures and Algorithms Storing String • 2. Variable- length storage with fixed maximum. ©SMT, Faculty, CSE, IUBAT
  • 7. 7 Data Structures and Algorithms Storing String • 2. Variable- length storage with fixed maximum. ©SMT, Faculty, CSE, IUBAT
  • 8. 8 Data Structures and Algorithms Storing String • 3. Linked storage ©SMT, Faculty, CSE, IUBAT
  • 9. 9 Data Structures and Algorithms String Operation • Length: LENGTH (string) e.g.- LENGTH(‘Mark Zuckerberg’)= 15 • Substring: SUBSTRING(string, initial, length) e.g.- SUBSTRING(‘Impossible is a word found in coward’s dictionary’,0,20) = Impossible is a word • Indexing: INDEX(string, pattern) e.g.- INDEX(‘He is wearing glasses’, ‘ear’)= 8 • Concatenation: String1//String2 e.g.- ‘To be or not to be’// ‘, this is the question.’= To be or not to be, this is the question ©SMT, Faculty, CSE, IUBAT
  • 10. ©SMT, Faculty, CSE, IUBAT String Operation • Word Processing- Insertion: INSERT(string, position, string) e.g.- INSERT(‘ABCDEIJKL’,5,‘FGH’)= ABCDEFGHIJKL Deletion: DELETE(string, position, length) e.g.- DELETE(‘ABCDEFG’, 4, 2)= ABCDG
  • 11. 11 Data Structures and Algorithms String Operation – Replacement: REPLACE(string, pattern1, pattern2) e.g.- REPLACE(‘XABYABZ’, ‘AB’, ‘c’)= XCYABZ REPLACE function can be executed be using the following three steps- 1. K:= INDEX(string, P1) 2. T:= DELETE(string, K, LENGTH(P1)) 3. INSERT(T, K, P1) – So, the algorithm is- ©SMT, Faculty, CSE, IUBAT
  • 12. 12 Data Structures and Algorithms String Operation – Pattern Matching: Pattern matching is the problem of deciding whether or not a given string pattern P appears in a text. Widely used in word processing. – So, a basic algorithm is- ©SMT, Faculty, CSE, IUBAT