Skip to Main Content
Data Structures Using C, 2nd Edition by Pearson
book

Data Structures Using C, 2nd Edition by Pearson

by A. K. Sharma
May 2024
Intermediate to advanced content levelIntermediate to advanced
521 pages
14h 12m
English
Pearson India
Content preview from Data Structures Using C, 2nd Edition by Pearson
Arrays: Searching and Sorting 141
void dispPol(int pol[])
{
int size;
int i;
size 5 pol[0]*2 + 1;
printf (“\n”);
for (i 5 1; i < size; i + 5 2)
{
printf (“%d*x^%d+”, pol[i], pol[i + 1]);
}
}
We can also choose other data structures to represent polynomials. For instance, a term can be
represented by ‘struct’ construct of ‘C’ as shown below:
struct term
{
int coef;
int exp;
};
and the polynomial called ‘pol’ of ten terms can be represented by an array of structures of type ‘term’
as shown below:
struct term pol1[10];
Now the algorithm merge() can be applied to add two such polynomials with above chosen data
structures. It is left as an exercise ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures Using C

Data Structures Using C

Samir Kumar Bandyopadhyay, Kashi Nath Dey
Intermediate C Programming, 2nd Edition

Intermediate C Programming, 2nd Edition

Yung-Hsiang Lu, George K. Thiruvathukal

Publisher Resources

ISBN: 9781299831582