# 2022q1 Homework1 (lab0)
contributed by < [`waig548`](https://github.com/waig548) >
# Requirements
- [x] Fork [lab0-c](https://github.com/sysprog21/lab0-c) on GitHub
- [ ] Implementation
- [ ] `queue.{c}`
- [x] `Queue Container`
- [x] `q_new`
- [x] `q_free`
- [x] `q_insert_head`
- [x] `q_insert_tail` - $O(1)$
- [x] `q_remove_head`
- [x] `q_remove_tail`
- [x] ~~`q_release_element`~~
- [x] `q_size` - $O(1)$
- [ ] `q_delete_mid`
- [ ] `q_delete_dup`
- [ ] `q_swap`
- [ ] `q_reverse`
- [ ] `q_sort`
- [ ] `q_shuffle`
- [Fisher–Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)
- [ ] A dump yard for to-be-deleted nodes?
- [ ] `qtest`
- [ ] `shuffle` -> `q_shuffle`
- [ ] `web`
- [ ] [tiny-web-server](https://github.com/7890/tiny-web-server)
- [ ] Use [Address Sanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer) to detect and fix errors from `qtest` during runtim
- [ ] Valgrind
- [ ] Fix memory errors
- [ ] Use Massif to visualize the memory usage during the simulation
- [ ] Explain the usage of [select](http://man7.org/linux/man-pages/man2/select.2.html) system call in this program
- [ ] Analyze the implementation of `console.c`, and the reasons behind its usage of the [RIO package](http://csapp.cs.cmu.edu/2e/ch10-preview.pdf) from CS:APP
- Reference: [CS:APP 第 10 章重點提示](https://hackmd.io/@sysprog/H1TtmVTTz)
- [ ] Read the paper [Dude, is my code constant time?](Dude, is my code constant time?)
- [ ] Explain how the "Simulation" mode verifies time complexity using experiments instad of theoretical analysis
- [ ] Explain the [Student’s t-distribution](https://en.wikipedia.org/wiki/Student%27s_t-distribution) and the implementation
> Current implementation contains serveral defects,
> please try to point them out and propose solutions
- [ ] Point out the defects in the current program, and make a pull request about them
# Implementation
[GitHub repo](https://github.com/waig548/lab0-c)
## `queue.c`