mid=⌊max(array)+min(array)2⌋, where max and min — are capacities that track down the maximum and the base array components. At the end of the day, mid is the amount of the maximum and the base component of array separated by 2 adjusted down.    Then, at that point, the array is parted into two parts left and

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

assume mid=⌊max(array)+min(array)2⌋, where max and min — are capacities that track down the maximum and the base array components. At the end of the day, mid is the amount of the maximum and the base component of array separated by 2 adjusted down. 

 

Then, at that point, the array is parted into two parts left and right. The left array contains all components which are not exactly or equal mid, and the right array contains all components which are greater than mid. Components in left and right maintain their relative control from array. 

 

During the third step we pick which of the left and right arrays we want to keep. The picked array replaces the current one and the other is permanently discarded. 

 

You want to assist Mike with discovering the aftereffects of q beauty tests. 

 

Note that you test the attractiveness of the array a, so you start each beauty test with the primordial (initial) array a. Consequently, the primary cut (whenever required) is always performed on the array a. 

 

Input 

 

Each test contains at least one experiments. The main line contains the number of experiments t (1≤t≤100). 

 

The main line of each experiment contains two integers n and q (1≤n,q≤105) — the length of the array an and the total number of beauty tests. 

 

The second line of each experiment contains n integers a1,a2,...,an (1≤ai≤106) — the substance of the array a. 

 

Next q lines of each experiment contain a solitary integer si (1≤si≤109) — the amount of components which Mike wants to get in the I-th test. 

 

It is guaranteed that the amount of n and the amount of q doesn't surpass 105 (∑n,∑q≤105). 

 

Output 

 

Print q lines, each containing either a "Yes" if the relating attractiveness test is passed and "No" in the contrary case.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Array
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education