0

how can i sort this algortihm

You are given a random list of decimals between 0 and 10. [ 3.2 ; 1.1 ; 2.8 ; 2.4 ; 1.4 ; 6.7 ; 3.0 ; 2.5 ; 1.1 ; 4.4 ....... ] Your algorithm should print out each decimal with the largest fraction among decimals that has the same whole-number part. Eg: [ 4.1 ; 4.6 ; 3.9 ; 4.0 ; 3.7 ; 2.1] should print [4.6 ; 3.9 ; 2.1] Design an algorithm that runs at O(n)

18th Nov 2019, 5:13 AM
Can GĂŒler
Can GĂŒler - avatar
3 Answers
+ 3
for which numbers do you filter? you say "each decimal [...] that has the same whole-number part" so I thought you were looking for numers such as 1.1, 8.8, 4.4, ... I'm confused because your example seemingly picked random numbers out of the array ... 😅 could you explain more? 😅😅
18th Nov 2019, 6:11 AM
Anton Böhler
Anton Böhler - avatar
+ 2
You have accidentally created two threads having similar case, though different in language specification. Kindly choose either one to keep, and remove the copy, so to help reducing duplicate questions https://www.sololearn.com/Discuss/2072685/?ref=app
18th Nov 2019, 9:04 AM
Ipang
+ 1
Show us your attempt first
18th Nov 2019, 5:17 AM
Aymane Boukrouh
Aymane Boukrouh - avatar