Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CSE 332 21au Students
para-practice
Commits
0a755dd9
Commit
0a755dd9
authored
Nov 09, 2021
by
Louis Maliyam
Browse files
Update README.md
parent
0739ce29
Changes
1
Show whitespace changes
Inline
Side-by-side
README.md
View file @
0a755dd9
...
...
@@ -7,62 +7,4 @@ This project is for you to get some practice with parallel programming using For
-
[
CountStrs
](
src/main/java/CountStrs.java
)
-
[
SecondSmallest
](
src/main/java/SecondSmallest.java
)
## LessThan7
```
java
public
static
int
lessThan7
(
int
[]
arr
)
```
lessThan7 returns the number of elements in
`arr`
that are less than 7.
For example, if
`arr`
is
`[21, 7, 6, 8, 17, 1]`
, then
`lessThan7(arr) == 2`
.
Your code must have
`O(n)`
work,
`O(lg(n))`
span, where
`n`
is the length of
`arr`
.
## Parity
```
java
public
static
boolean
parity
(
int
[]
arr
)
```
parity returns
`true`
if there are even number of even numbers and
`false`
otherwise.
For example, if
`arr`
is
`[1, 7, 4, 3, 6]`
, then
`parity(arr) == true`
. But, if
`arr`
is
`[6, 5, 4, 3, 2, 1]`
,
`parity(arr) == false`
.
Your code must have
`O(n)`
work,
`O(lg(n))`
span, where
`n`
is the length of
`arr`
.
## PowMod
```
java
public
static
void
powmod
(
int
[]
arr
,
int
p
,
int
m
)
```
powMod replaces every element of
`arr`
with
`arr[i]^p mod m`
.
For example, if
`arr`
is
`[1, 7, 4, 3, 6]`
, then
`powmod(arr, 2, 5)`
would result in
`arr = [1, 4, 1, 4, 1]`
.
Your code must have
`O(n)`
work,
`O(lg(n))`
span, where
`n`
is the length of
`arr`
.
## CountStrs
```
java
public
static
int
countStrs
(
String
str
,
String
[]
arr
)
```
countStrs returns the number of elements in
`arr`
that equal
`str`
.
For example, if
`arr`
is
`["h", "ee", "llll", "llll", "oo", "llll"]`
, then
`countStrs(arr, "llll") == 3`
and
`countStrs(arr, "h") == 1`
.
Your code must have
`O(n)`
work,
`O(lg(n))`
span, where
`n`
is the length of
`arr`
.
## SecondSmallest
```
java
public
static
int
secondSmallest
(
int
[]
arr
)
```
secondSmallest returns the second smallest unique element of
`arr`
. Assume
`arr`
contains at least two unique elements.
For example, if
`arr`
is
`[1, 7, 4, 3, 6]`
, then
`secondSmallest(arr) == 3`
. But, if
`arr`
is
`[6, 1, 4, 3, 5, 2, 1]`
,
`secondSmallest(arr) == 2`
.
Your code must have
`O(n)`
work,
`O(lg(n))`
span, where
`n`
is the length of
`arr`
.
\ No newline at end of file
Please read the comments in each file for instructions.
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment