Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the value of N where N ranges from 1,26] and Q where Q is the maximum number of queries that one can make, sort

image text in transcribed
Given the value of N where N ranges from 1,26] and Q where Q is the maximum number of queries that one can make, sort a list of distinct uppercase alphabets in ascending order. N indicates that there are N characters starting from 'A'. Hence, N = 5 means that our final list must contain 'A.'B,C D' and A single query is defined as printing out a string "? x y" where x and y represent the characters we want to check the relation between (e.g. " A B"). The problem restricts the number of such queries to Q. Hence, we must determine the final order of the characters using at most Q queries. For each query, we get a binary answer '' or'>' from stdin indicates that x comes before y in the final list.means otherwise I was wondering how to solve this problem, i mean how can i code the input that just randomly choose from ABCDE for example and give output such as ?AC ? AD . Please someone help me giving the idea for this

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

Students also viewed these Databases questions

Question

To find integral of sin(logx) .

Answered: 1 week ago

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago