American Young Coder (AYC)

• This event has passed.

# 3 PM – Intro To Competitive Programming – Gamas

## April 20 @ 3:00 pm - 4:00 pm

##### Today We Did
1. We reviewed Maximizing Productivity USACO Feb 2024 Bronze problem from  https://usaco.org/index.php?page=viewproblem2&cpid=1397. We discussed how to optimize the solution from Big O(N^2) to Big O (N Log N) and passed all the test cases.
2. We reviewed the Milk Exchange USACO Feb 2024 Bronze problem from https://usaco.org/index.php?page=viewproblem2&cpid=1396 . We discussed the optimize solution.
##### Homework
1. We want to dig deep into Java sorting mechanism. Look at SortingTutorial.java we did several months ago.
2. Create a new class GameSorting.java. Inside this class, create a List<Game>. And add 6 games to it.
1. Mario, \$60, Not on sale
2. Kirby, \$55, Not on sale
3. Donkey kong, \$30, on sale.
4. Zelda, \$65, Not on sale.
5. Hero, \$20, on sale.
6. Sticky Man, \$25, on sale.
3. Sort the above list of game according to its price ascending order.
4. Sort the above list of game according to its price descending order.
5. Use below Game.java class
6. ```public class Game {
private String name;
private double price;
private boolean onSale;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public double getPrice() {
return price;
}

public void setPrice(double price) {
this.price = price;
}

public boolean isOnSale() {
return onSale;
}

public void setOnSale(boolean onSale) {
this.onSale = onSale;
}

public Game(String name, double price, boolean onSale) {
this.name = name;
this.price = price;
this.onSale = onSale;
}
}```

## Details

Date:
April 20
Time:
3:00 pm - 4:00 pm