WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.2% of users enabled 2FA.

Commit f650f6ae authored by John Zhang's avatar John Zhang
Browse files

fix mistake in x label; run quicksort with input size, plot result; inline functions in C quicksort

parent d0277c17
......@@ -320,24 +320,21 @@ def plot(result_dic):
ax.text(width * (i + 1), avg - std_dev, "%.6f" % std_dev, color='#1d1f21', fontweight='bold')
# plt.legend(loc=2)
plt.xticks([width * (i + 1) for i in range(len(targets))], targets)
plt.xticks([width * (i + 1) for i in range(len(targets))], [tgt for (tgt, _, _) in data])
plt.title("%(test_name)s with input size %(input_size)d" % result_dic)
plt.show()
def test_plot():
plot(perf_quicksort(1000, 20))
# import json
# with open('result_quicksort.json', 'r') as fp:
# dic = json.load(fp)
# plot(dic)
if __name__ == '__main__':
import sys
N = int(sys.argv[1])
# fib_res = perf_fibonacci(40, 20)
# save_results('fibonacci', fib_res)
# arraysum_res = perf_arraysum(1000000, 20)
# save_results('arraysum', arraysum_res)
# quicksort_res = perf_quicksort(1000000, 20)
# save_results('quicksort', quicksort_res)
test_functional_quicksort()
quicksort_res = perf_quicksort(N, 100)
save_results('quicksort', quicksort_res)
plot(quicksort_res)
#include <stdint.h>
#include "quicksort.h"
void swap(int64_t* arr, int64_t i, int64_t j) {
static inline void swap(int64_t* arr, int64_t i, int64_t j) {
int64_t t;
t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
int64_t partition(int64_t* arr, int64_t idx_low, int64_t idx_high) {
static inline int64_t partition(int64_t* arr, int64_t idx_low, int64_t idx_high) {
int64_t pivot, i, j;
pivot = arr[idx_high];
i = idx_low;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment