Skip to content

Commit 53799fd

Browse files
committed
Fixed Big-O typo
1 parent 356cea0 commit 53799fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Ordered Set/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Lets take a look at the insert function first. The insert function first checks
6565
internalSet.append(item)
6666
}
6767
```
68-
The first part of the function checks if the item is already in the set.As we'll see later on, this has an efficiency of **O(nlog n + k)**. The second part iterates through the interal array so that it can find a spot for our given item. This is at worse **O(n)**. The insert function for arrays has an efficiency of **O(nlog(n))**, thus making the insert function for our Ordered Set **O(nlog(n) + k)** where k is the number of items with the same value as the item we are inserting.
68+
The first part of the function checks if the item is already in the set.As we'll see later on, this has an efficiency of **O(log n + k)** where k is the number of items with the same value as the item we are inserting. The second part iterates through the interal array so that it can find a spot for our given item. This is at worse **O(n)**. The insert function for arrays has an efficiency of **O(log(n))**, thus making the insert function for our Ordered Set **O(log(n) + k)**.
6969

7070

7171
Next we have the remove function. First check if the item exists. If not, then return and no nothing. If it does exist, remove it.
@@ -80,7 +80,7 @@ Next we have the remove function. First check if the item exists. If not, then r
8080
internalSet.removeAtIndex(findIndex(item))
8181
}
8282
```
83-
Again, because of the `exists` function, the efficiency for remove is **O(nlog(n) + k)**
83+
Again, because of the `exists` function, the efficiency for remove is **O(log(n) + k)**
8484

8585

8686
*Written By Zain Humayun*

0 commit comments

Comments
 (0)