Algorithm A4: index(T, P) 1. Initialize i = 0 and max = t – p + 1 / * t and p are respectively lengths of strings T and P * / 2. Repeat steps 3 to 6 while i < max 3. Repeat for j = 0 to p – 1 5. Return index i and exit 6. i = i + 1 7. Return –1 for no match 8. Exit

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter1: Fundamentals Of C++ Programming
Section1.4: Preliminary Four: Algorithms
Problem 7E: (Data processing) a. Write an algorithm to locate the first occurrence of the name JEAN in a list of...
icon
Related questions
Question

4) Algorithm A4: index(T, P)
1. Initialize i = 0 and max = t – p + 1 / * t and p are respectively lengths
of strings T and P * /
2. Repeat steps 3 to 6 while i < max
3. Repeat for j = 0 to p – 1
5. Return index i and exit
6. i = i + 1
7. Return –1 for no match
8. Exit
LAB TASKS
1. Implement the above algorithms using functions in C++

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Header Files
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning