Click here to Skip to main content
15,886,963 members
Home / Discussions / Java
   

Java

 
GeneralRe: Operator precedence Pin
jeron112-Jul-23 6:15
jeron112-Jul-23 6:15 
AnswerRe: Operator precedence Pin
Richard MacCutchan11-Jul-23 5:24
mveRichard MacCutchan11-Jul-23 5:24 
GeneralRe: Operator precedence Pin
darek2902198812-Jul-23 5:46
darek2902198812-Jul-23 5:46 
QuestionRe: Operator precedence Pin
Richard MacCutchan12-Jul-23 6:15
mveRichard MacCutchan12-Jul-23 6:15 
AnswerRe: Operator precedence Pin
Andre Oosthuizen14-Jul-23 1:36
mveAndre Oosthuizen14-Jul-23 1:36 
GeneralRe: Operator precedence Pin
Richard MacCutchan14-Jul-23 1:52
mveRichard MacCutchan14-Jul-23 1:52 
QuestionSign a PDF document in PAdeS format using a CNS (National Services Card) or a SmartCard. Pin
Antonio20238-Jul-23 19:45
Antonio20238-Jul-23 19:45 
QuestionRelative Sorting Pin
Harriet Muduwa26-Jun-23 6:42
Harriet Muduwa26-Jun-23 6:42 
Relative Sorting
Ramesh is given two arrays, arr1 and arr2. He wants to sort arr1 in such a way that the relative order of arr2 is maintained in arr1. For elements that are not present in arr2, he wants to add the these elements at the end of the array in sorted fashion.

Can you help Ramesh achieve this task?

Input Format
First line contains two integers n and m denoting size of arrays arr1 and arr2 respectively.

Second line contains n space separated integers denoting the array arr1.

Third line contains m space separated integers denoting the array arr2.

Output Format
Print the relatively sorted arr1

Example 1
Input

11 4
2 1 2 5 7 1 9 3 6 8 8
2 1 8 3
Ramesh is given two arrays, arr1 and arr2. He wants to sort arr1 in such a way that the relative order of arr2 is maintained in arr1. For elements that are not present in arr2, he wants to add the these elements at the end of the array in sorted fashion.

Can you help Ramesh achieve this task?

Input Format
First line contains two integers n and m denoting size of arrays arr1 and arr2 respectively.

Second line contains n space separated integers denoting the array arr1.

Third line contains m space separated integers denoting the array arr2.

Output Format
Print the relatively sorted arr1

Example 1
Input

11 4
2 1 2 5 7 1 9 3 6 8 8
2 1 8 3
AnswerRe: Relative Sorting Pin
Pete O'Hanlon26-Jun-23 7:12
mvePete O'Hanlon26-Jun-23 7:12 
AnswerRe: Relative Sorting Pin
Victor Nijegorodov26-Jun-23 7:13
Victor Nijegorodov26-Jun-23 7:13 
AnswerRe: Relative Sorting Pin
jimakoskx28-Jun-23 23:34
jimakoskx28-Jun-23 23:34 
AnswerRe: Relative Sorting Pin
jimakoskx28-Jun-23 23:54
jimakoskx28-Jun-23 23:54 
QuestionGiven an array arr of size N. Pin
Member 1603793426-Jun-23 6:40
Member 1603793426-Jun-23 6:40 
AnswerRe: Given an array arr of size N. Pin
Victor Nijegorodov26-Jun-23 7:12
Victor Nijegorodov26-Jun-23 7:12 
AnswerRe: Given an array arr of size N. Pin
Richard MacCutchan26-Jun-23 8:18
mveRichard MacCutchan26-Jun-23 8:18 
QuestionHow to make "upload video" in web application ? Pin
Noor Fatima BSSE202111-Mar-23 6:39
Noor Fatima BSSE202111-Mar-23 6:39 
AnswerRe: How to make "upload video" in web application ? Pin
jschell27-Mar-23 7:08
jschell27-Mar-23 7:08 
QuestionClient can't connect to server when client/server are different projects Pin
Valentinor17-Feb-23 20:50
Valentinor17-Feb-23 20:50 
AnswerRe: Client can't connect to server when client/server are different projects Pin
Valentinor17-Feb-23 21:53
Valentinor17-Feb-23 21:53 
GeneralRe: Client can't connect to server when client/server are different projects Pin
englebart26-Apr-23 16:14
professionalenglebart26-Apr-23 16:14 
AnswerRe: Client can't connect to server when client/server are different projects Pin
Richard MacCutchan17-Feb-23 21:58
mveRichard MacCutchan17-Feb-23 21:58 
GeneralRe: Client can't connect to server when client/server are different projects Pin
Valentinor17-Feb-23 22:13
Valentinor17-Feb-23 22:13 
GeneralRe: Client can't connect to server when client/server are different projects Pin
Richard MacCutchan17-Feb-23 22:46
mveRichard MacCutchan17-Feb-23 22:46 
GeneralRe: Client can't connect to server when client/server are different projects Pin
Valentinor17-Feb-23 23:05
Valentinor17-Feb-23 23:05 
Questionfull answer with code pls Pin
Member 159126962-Feb-23 12:06
Member 159126962-Feb-23 12:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.