Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You took N number of books from the library. You are done reading all the books. Now you have to go to the library and

You took N number of books from the library. You are done reading all the books. Now you have to go to the library and keep those books on the bookshelf in their Alphabetically ordered position. But there is a problem. All the other books in the bookshelf are kept without any order and the librarian will sort the books later. But you want to keep your books in such a way that their actual alphabetical position is maintained without sorting all the books. But you might change the other book's position according to your need.
Input
The first line contains an integer N(1N103), denoting the number of books you took from the library. The second line contains an array of Alphabets, denoting your book's name. The third line contains an array of Alphabets, denoting all the other book names which are already kept on the bookshelf without any order.
Output:
Return the array of the books where your books are in their specific position.
[N.B: Returned array can vary according to your approach. But you have to make sure that all of your books are in their actual alphabetically ordered position.]
Sample Input/Output:
\table[[Sample Input 1,Sample Output 1],[3,A C D G E M V S Z P],[C S M,],[P V D Z G A,],[Sample Input 2,Sample Output 2],[2,F C D L K O Y X Q],[X O,],[F D L YKQ,]]
SOLVE USING PYTHON
image text in transcribed

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