Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
H

Harriet Muduwa

@Harriet Muduwa
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Relative Sorting
    H Harriet Muduwa

    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

    Java algorithms data-structures help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups