Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 02b56b7

Browse files
Fix some complexities in IntMap.Strict (#1114)
1 parent 369fb4b commit 02b56b7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎containers/src/Data/IntMap/Strict/Internal.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ alter f !k t =
586586
Just !x -> Tip k x
587587
Nothing -> Nil
588588

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
590590
-- @k@, or absence thereof. 'alterF' can be used to inspect, insert, delete,
591591
-- or update a value in an 'IntMap'. In short : @'lookup' k \<$\> 'alterF' f k m = f
592592
-- ('lookup' k m)@.
@@ -765,7 +765,7 @@ mergeWithKey f g1 g2 = mergeWithKey' bin combine g1 g2
765765
Min\/Max
766766
--------------------------------------------------------------------}
767767

768-
-- | \(O(\log n)\). Update the value at the minimal key.
768+
-- | \(O(\min(n,W))\). Update the value at the minimal key.
769769
--
770770
-- > updateMinWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"3:b"), (5,"a")]
771771
-- > updateMinWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
@@ -781,7 +781,7 @@ updateMinWithKey f t =
781781
Nothing -> Nil
782782
go _ Nil = Nil
783783

784-
-- | \(O(\log n)\). Update the value at the maximal key.
784+
-- | \(O(\min(n,W))\). Update the value at the maximal key.
785785
--
786786
-- > updateMaxWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"b"), (5,"5:a")]
787787
-- > updateMaxWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
@@ -797,15 +797,15 @@ updateMaxWithKey f t =
797797
Nothing -> Nil
798798
go _ Nil = Nil
799799

800-
-- | \(O(\log n)\). Update the value at the maximal key.
800+
-- | \(O(\min(n,W))\). Update the value at the maximal key.
801801
--
802802
-- > updateMax (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "Xa")]
803803
-- > updateMax (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
804804

805805
updateMax :: (a -> Maybe a) -> IntMap a -> IntMap a
806806
updateMax f = updateMaxWithKey (const f)
807807

808-
-- | \(O(\log n)\). Update the value at the minimal key.
808+
-- | \(O(\min(n,W))\). Update the value at the minimal key.
809809
--
810810
-- > updateMin (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "Xb"), (5, "a")]
811811
-- > updateMin (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
@@ -967,7 +967,7 @@ mapAccumRWithKey f0 a0 t0 = toPair $ go f0 a0 t0
967967
Tip k x -> let !(a',!x') = f a k x in (a' :*: Tip k x')
968968
Nil -> (a :*: Nil)
969969

970-
-- | \(O(n \log n)\).
970+
-- | \(O(n \min(n,W))\).
971971
-- @'mapKeysWith' c f s@ is the map obtained by applying @f@ to each key of @s@.
972972
--
973973
-- The size of the result may be smaller if @f@ maps two or more distinct

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /