+ some descriptions
This commit is contained in:
parent
5f362d3d2a
commit
6fb3eb82f2
4 changed files with 21 additions and 34 deletions
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
slug: /silver/binary-search
|
||||
title: "Silver - Binary Search"
|
||||
title: "Binary Search"
|
||||
author: Unknown
|
||||
order: 4
|
||||
---
|
||||
|
|
|
@ -5,25 +5,17 @@ author: Siyong Huang
|
|||
order: 7
|
||||
---
|
||||
|
||||
<ul class="syllabus-only">
|
||||
<li>Prerequisites</li>
|
||||
<li>Depth First Search (DFS)</li>
|
||||
<li>Flood Fill</li>
|
||||
<li>Graph Two-Coloring</li>
|
||||
<li>Cycle Detection</li>
|
||||
</ul>
|
||||
|
||||
<!-- END DESCRIPTION -->
|
||||
|
||||
## Overview
|
||||
|
||||
- Prerequisites
|
||||
- Introduction to Graphs
|
||||
- Depth First Search (DFS)
|
||||
- Flood Fill
|
||||
- Graph Two-Coloring
|
||||
- Cycle Detection
|
||||
|
||||
## Prerequisites
|
||||
<!-- END DESCRIPTION -->
|
||||
|
||||
## Introduction to Graphs
|
||||
|
||||
- [CSAcademy Graph Intro](https://csacademy.com/lesson/introduction_to_graphs)
|
||||
- [CSAcademy Graph Representations](https://csacademy.com/lesson/graph_representation)
|
||||
|
|
|
@ -5,13 +5,11 @@ author: Benjamin Qi
|
|||
order: 4
|
||||
---
|
||||
|
||||
<div class="syllabus-only">
|
||||
Description: Todo
|
||||
</div>
|
||||
A [topological sort](https://en.wikipedia.org/wiki/Topological_sorting) of a directed graph is a linear ordering of its vertices such that for every directed edge $u\to v$ from vertex $u$ to vertex $v$, $u$ comes before $v$ in the ordering.
|
||||
|
||||
# Gold - [Topological Sort](https://en.wikipedia.org/wiki/Topological_sorting)
|
||||
<!-- END DESCRIPTION -->
|
||||
|
||||
Author: Benjamin Qi
|
||||
## Example Problems
|
||||
|
||||
- [CSES Course Schedule](https://cses.fi/problemset/task/1679)
|
||||
- [CSES Longest Flight Route](https://cses.fi/problemset/task/1680)
|
||||
|
@ -21,6 +19,7 @@ Author: Benjamin Qi
|
|||
|
||||
- CPH 16.1, 16.2
|
||||
- [cp-algorithms](https://cp-algorithms.com/graph/topological-sort.html)
|
||||
-
|
||||
|
||||
## Problems
|
||||
|
||||
|
|
|
@ -5,31 +5,27 @@ author: Benjamin Qi
|
|||
order: 5
|
||||
---
|
||||
|
||||
<div class="syllabus-only">
|
||||
Description: Todo
|
||||
</div>
|
||||
|
||||
<!-- END DESCRIPTION -->
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Assumes that you are familiar with prefix sum queries (CPH 9.1).
|
||||
|
||||
## Task
|
||||
Given an array of size $N$, perform the following tasks in $O(\log N)$ time each:
|
||||
|
||||
Given an array of size $N$, the task is to update the element at a single position (point) in addition to querying the sum of a prefix in $O(\log N)$ time each.
|
||||
- Update the element at a single position (point).
|
||||
- Querying the sum of a prefix of the array.
|
||||
|
||||
Sample Problems:
|
||||
The easiest way to do this is with a **Binary Indexed Tree.**
|
||||
<!-- END DESCRIPTION -->
|
||||
|
||||
## Binary Indexed Tree
|
||||
|
||||
Probably the easiest way to do all of these tasks (aka **Fenwick Tree**).
|
||||
|
||||
### Sample Problems
|
||||
|
||||
* [CSES Range Sum Queries II](https://cses.fi/problemset/task/1648)
|
||||
* can also do range XOR queries w/ update
|
||||
* [SPOJ Inversion Counting](https://www.spoj.com/problems/INVCNT/)
|
||||
|
||||
## Binary Indexed Tree
|
||||
|
||||
Probably the easiest way to do all of these tasks (aka Fenwick Tree).
|
||||
|
||||
Tutorials:
|
||||
### Tutorials
|
||||
|
||||
* CPH 9.2 (very good)
|
||||
* [CSAcademy BIT](https://csacademy.com/lesson/fenwick_trees) (also very good)
|
||||
|
|
Reference in a new issue