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)
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? đ
đ
+ 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
+ 1
Show us your attempt first