Skip to content

Instantly share code, notes, and snippets.

@rahcola rahcola/gist:3807597
Created Sep 30, 2012

What would you like to do?
a PSEUDO C translation of week 4. exercise 2.
divResult mod_div_polynomials(int mod,
termNode* p,
termNode* q) {
termNode* r = p;
termNode* s = NULL;
int b_inverse = ...;
for (int i = p->deg - q->deg; i >= 0; i--) {
if (r->deg == q->deg + i) {
int qi = r->coef * b_inverse;
termNode* t = mod_mul_polynomials(mod, make_term(i, -qi), q);
r = mod_add_polynomials(mod, r, t);
s = mod_add_polynomials(mod, s, make_term(i, qi));
return {s, r};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.