Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

https://github.com/jortizcs-rutgers/PM1-public/tree/master/lab4 the link has skeleton code and please use details for .cpp and .h files and code in C++ thanks. Solve problem 2 using binary

image text in transcribed

https://github.com/jortizcs-rutgers/PM1-public/tree/master/lab4

the link has skeleton code and please use details for .cpp and .h files and code in C++ thanks.

Solve problem 2 using binary search

Problem 1 Given a text txt[0..n-1] and a pattern pat[O..m-1], write a function search(char patD, char txtD) that prints all occurrences of pat[] in txt]. You may assume that n>m. Input: txt[] "THIS IS A TEST TEXT Output: Pattern found at index 10 Input: txt]"AABAACAADAABAABA" Output: Pattern found at index e pat] "TEST pat[-"AABA" Pattern found at index 9 Pattern found at index 12 Problem 2 Given a sorted array of String and a String x, find index of x if it is present in the array using binary search. Input : arr[] -{ "contribute", "geeks", "ide", "practice"), x- "ide" Output 2 The String x is present at index 2 Input : arr[] -"contribute", "geeks", "ide", "practice", x - "zz" output-1 The String "zz" is not present

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions