Algorithm/DS Problem#1: Find the relative order of records
May 26, 2021
Problem Statement: You are given a set of records with keys and you need to find out the relative order of keys.
records=[[‘k1’,’k2',’k5'],[‘k0’,’k2',’k3'],[‘k4’,’k5',’k6']]
Output: [‘k1’, ‘k0’, ‘k4’, ‘k2’, ‘k5’, ‘k3’, ‘k6’] or [‘k4’, ‘k0’, ‘k1’, ‘k2’, ‘k5’, ‘k3’, ‘k6’]
You are expected to keep the order intact in the output. k1 should come before k2 and k0 also should come before k2.