@@ -586,7 +586,7 @@ alter f !k t =
586
586
Just ! x -> Tip k x
587
587
Nothing -> Nil
588
588
589
- -- | \(O(\log n )\). The expression (@'alterF' f k map@) alters the value @x@ at
589
+ -- | \(O(\min(n,W) )\). The expression (@'alterF' f k map@) alters the value @x@ at
590
590
-- @k@, or absence thereof. 'alterF' can be used to inspect, insert, delete,
591
591
-- or update a value in an 'IntMap'. In short : @'lookup' k \<$\> 'alterF' f k m = f
592
592
-- ('lookup' k m)@.
@@ -765,7 +765,7 @@ mergeWithKey f g1 g2 = mergeWithKey' bin combine g1 g2
765
765
Min\/Max
766
766
--------------------------------------------------------------------}
767
767
768
- -- | \(O(\log n )\). Update the value at the minimal key.
768
+ -- | \(O(\min(n,W) )\). Update the value at the minimal key.
769
769
--
770
770
-- > updateMinWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"3:b"), (5,"a")]
771
771
-- > updateMinWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
@@ -781,7 +781,7 @@ updateMinWithKey f t =
781
781
Nothing -> Nil
782
782
go _ Nil = Nil
783
783
784
- -- | \(O(\log n )\). Update the value at the maximal key.
784
+ -- | \(O(\min(n,W) )\). Update the value at the maximal key.
785
785
--
786
786
-- > updateMaxWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"b"), (5,"5:a")]
787
787
-- > updateMaxWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
@@ -797,15 +797,15 @@ updateMaxWithKey f t =
797
797
Nothing -> Nil
798
798
go _ Nil = Nil
799
799
800
- -- | \(O(\log n )\). Update the value at the maximal key.
800
+ -- | \(O(\min(n,W) )\). Update the value at the maximal key.
801
801
--
802
802
-- > updateMax (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "Xa")]
803
803
-- > updateMax (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
804
804
805
805
updateMax :: (a -> Maybe a ) -> IntMap a -> IntMap a
806
806
updateMax f = updateMaxWithKey (const f)
807
807
808
- -- | \(O(\log n )\). Update the value at the minimal key.
808
+ -- | \(O(\min(n,W) )\). Update the value at the minimal key.
809
809
--
810
810
-- > updateMin (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "Xb"), (5, "a")]
811
811
-- > updateMin (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
@@ -967,7 +967,7 @@ mapAccumRWithKey f0 a0 t0 = toPair $ go f0 a0 t0
967
967
Tip k x -> let ! (a',! x') = f a k x in (a' :*: Tip k x')
968
968
Nil -> (a :*: Nil )
969
969
970
- -- | \(O(n \log n )\).
970
+ -- | \(O(n \min(n,W) )\).
971
971
-- @'mapKeysWith' c f s@ is the map obtained by applying @f@ to each key of @s@.
972
972
--
973
973
-- The size of the result may be smaller if @f@ maps two or more distinct
0 commit comments