Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 2 3 4 6
- 2 3 4 5 7
- 1 2 3 4 5
- 1 2 3 4 5
- 2 3 4 5 7
- Single Pass (O(C))
- M(1)={0,2,3}
- M(2)={1,4}
- Single Pass with in rows of M(1) O(M(1)) only considering rows in M(1) (a) indicates a is common in those rows
- (1) 2 3 4 6
- (1) 2 3 4 5
- (1) 2 3 4 5
- Single Pass (O(M(1)))
- M1(2)={0,2,3}
- (1 2) 3 4 6
- (1 2) 3 4 5
- (1 2) 3 4 5
- Single Pass (O(M1(2)))
- M2(3)={0,2,3}
- (1 2 3) 4 6
- (1 2 3) 4 5
- (1 2 3) 4 5
- Single Pass (O(M2(3)))
- M3(4)={0,2,3}
- (1 2 3 4) 6
- (1 2 3 4) 5
- (1 2 3 4) 5
- Single Pass (O(M3(4)))
- M4(6)={0}
- M4(5)={2,3}
- Here M4(6) ={0} have length as 1 so mark referenceIndex[0]=0
- (1 2 3 4 6 )
- Here M4(5) ={2,3} have covered all elements and still the M4(5) ={2,3} have lenght 2 which means row (2,3) are same so mark referenceIndex[2]=referenceIndex[3]=2(any of 2,3)
- (1 2 3 4 5)
- (1 2 3 4 5)
- You can follow the same with M(2)also and mark referenceIndex for all its elements .
- Once you mark refernce index for all , we have proper list with duplicates .
- This can be acchived by using the stack or recursion .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement