void delete_top_test(Stats_Log *log, Buffer_Set *buffers, int test_repitions, float *advance_data, int edit_count, void *scratch, int scratch_size, Record_Statistics *stats_out){ Sample_Machine machine; machine = begin_machine(test_repitions, &scratch, &scratch_size); int len = 5; int i, j; for (i = 0; i < test_repitions; ++i){ start(&machine); for (j = 0; j < edit_count; ++j){ delete_top(&buffers->buffer, len, advance_data, scratch, scratch_size); } machine.samples[i].buffer = stop(&machine); start(&machine); for (j = 0; j < edit_count; ++j){ delete_top(&buffers->gap_buffer, len, advance_data, scratch, scratch_size); } machine.samples[i].gap_buffer = stop(&machine); start(&machine); for (j = 0; j < edit_count; ++j){ delete_top(&buffers->multi_gap_buffer, len, advance_data, scratch, scratch_size); } machine.samples[i].multi_gap_buffer = stop(&machine); start(&machine); for (j = 0; j < edit_count; ++j){ delete_top(&buffers->rope_buffer, len, advance_data, scratch, scratch_size); } machine.samples[i].rope_buffer = stop(&machine); if (i == 0){ stream_check_test(buffers, scratch, scratch_size); } } end_machine(&machine, stats_out, __FUNCTION__); log_sample_set(log, litstr("delete-top"), stats_out, machine.samples, machine.count); }
int pa(t_element **a, t_element **b, char *letter) { if (*b == NULL) return (1); my_putstr(letter); *a = add_top(*a, (*b)->val); *b = delete_top(*b); return (1); }
void heap_merge(int matrix[][MAXSIZE], int m, int n, int out[]) { int out_no; int row; int temp; prepare(matrix, m, n); /* prepare the initial heap */ out_no = 0; /* # of output = 0 */ while ((temp = delete_top(&row)) != INT_MAX) { out[out_no++] = temp; /* always output the top */ insert(ask_data(matrix, row), row); /* ins. new */ } release(); /* release all memeory */ }