succession of non-negative integers a1,a2,… ,an is called developing if for all I from 1 to n−1 every one of the ones (of twofold portrayal) in man-made intelligence are in the spots of ones (of paired portrayal) in ai+1 (all in all, ai&ai+1=ai, where and indicates bitwise AND). In the event that n=1, the arrangement is viewed as developing too.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Detail code and output screenshot. Correct answer will upvoted else downvoted.

 

succession of non-negative integers a1,a2,… ,an is called developing if for all I from 1 to n−1 every one of the ones (of twofold portrayal) in man-made intelligence are in the spots of ones (of paired portrayal) in ai+1 (all in all, ai&ai+1=ai, where and indicates bitwise AND). In the event that n=1, the arrangement is viewed as developing too. 

 

For instance, the accompanying four groupings are developing: 

 

[2,3,15,175] — in double it's [102,112,11112,101011112]; 

 

[5] — in paired it's [1012]; 

 

[1,3,7,15] — in paired it's [12,112,1112,11112]; 

 

[0,0,0] — in paired it's [02,02,02]. 

 

The accompanying three successions are non-developing: 

 

[3,4,5] — in paired it's [112,1002,1012]; 

 

[5,4,3] — in paired it's [1012,1002,0112]; 

 

[1,2,4,8] — in paired it's [00012,00102,01002,10002]. 

 

Consider two successions of non-negative integers x1,x2,… ,xn and y1,y2,… ,yn. How about we call this pair of successions co-developing if the grouping x1⊕y1,x2⊕y2,… ,xn⊕yn is developing where ⊕ indicates bitwise XOR. 

 

You are given a succession of integers x1,x2,… ,xn. Discover the lexicographically insignificant succession y1,y2,… ,yn to such an extent that groupings xi and yi are co-developing. 

 

The grouping a1,a2,… ,an is lexicographically more modest than the succession b1,b2,… ,bn if there exists 1≤k≤n with the end goal that ai=bi for any 1≤i<k however ak<bk. 

Input :The main line contains an integer t (1≤t≤104). Then, at that point, t experiments follow. The main line of each experiment contains an integer n (1≤n≤2⋅105) — length of the succession xi. The subsequent line contains n integers x1,x2,… ,xn (0≤xi<230) — components of the grouping xi. It is ensured that the amount of n by and large all experiments doesn't surpass 2⋅105. 

Output :For each experiment, print n integers y1,y2,… ,yn (0≤yi<230) — lexicographically negligible grouping to such an extent that to such an extent that it's co-developing with given arrangement xi.

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY