Re: polynomial multiplication
- From: Peter Nilsson <airia@xxxxxxxxxxx>
- Date: Mon, 15 Mar 2010 15:46:29 -0700 (PDT)
Ashton K <ash...@xxxxxxxxxxxxxx> wrote:
Alf P. Steinbach <al...@xxxxxxxx> wrote:
arun:
I am trying to solve the problems in "Data Structures and
Algorithm Analysis in C".
One of the questions asks you to find algorithms to find
the product of two polynomials. The polynomials are
represented using linked lists. The terms in the list may
not be in sorted order. However the product itself should
be a linked list where there is a single term for any
power and is sorted by exponent. ...
The straightforward way, when limited to using linked
lists, no arrays, goes like O(mn log(mn)) -- loop for
multiplication, a sort, collection of likes.
Create a new scratch space (linked list). For every element
n of the list N, multiply n by every element m in the list M.
Place all these new elements on the scratch space.
If you're going to allocate scratch space, then an O(m + n)
array will get you O(mn) multiplication.
--
Peter
.
- Follow-Ups:
- Re: polynomial multiplication
- From: Alf P. Steinbach
- Re: polynomial multiplication
- References:
- polynomial multiplication
- From: arun
- Re: polynomial multiplication
- From: Alf P. Steinbach
- Re: polynomial multiplication
- From: Ashton K
- polynomial multiplication
- Prev by Date: Re: A question about programming...
- Next by Date: Re: polynomial multiplication
- Previous by thread: Re: polynomial multiplication
- Next by thread: Re: polynomial multiplication
- Index(es):
Relevant Pages
|