0% found this document useful (0 votes)
10 views28 pages

GLL by Chaitali Patil

Uploaded by

omsingh300710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views28 pages

GLL by Chaitali Patil

Uploaded by

omsingh300710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Generalized Linked lists

BY CHAITALI PATIL

Assistant Professor,Dept. of Computer Engg.


K.K.Wagh Institute of Engineering Education
and Research, Nashik
2

 Generalized lists are defi ned recursively as lists


whose members may be single data elements or
other generalized lists. Generalized lists are the most
fl exible and useful structures. We can use such lists
to represent virtually all of the data structures.
 In addition, generalized lists provide the key data
structure for several programming languages, such
as LISP.
 Definition :A generalized list is a linear list (non-
indexed) of zero or more data elements or
generalized lists.

Chaitali Patil
Some examples of generalized lists
3

1. A = () The empty (or null) list.


2. B = (a, (b, c), d) List of three elements—the first
element is a, the second element is list (b, c), and the
third element is d.
3. C = (B, B, A) List of length 3 with the first and the
second element as list B and the third element as list
A, which is a null list.
4. D = (a, b, D) List of length 3 which is recursive as
it includes itself as one of the elements. It can also be
written as D = (a, b, (a, b, (a, b, ...) ...

Chaitali Patil
4

Chaitali Patil
5

Chaitali Patil
6

Chaitali Patil
The lists could be one of the following categories
7

1. Lists with no shared references—The components of one list


are not members of any other list. In example 2, B is a list
with no shared references.
2. Lists with shared references—The components of one list can
be the members of another list. The logical interpretation of
lists leads to two categories as the following:
(a) Static interpretation— The current status of the referenced
list is anticipated. The referenced list is copied into the
referencing list.
(b) Dynamic interpretation— The list itself is anticipated. Any
future changes in the referenced list should be reflected in the
referencing list.
3. Recursive list—A recursive list is the one that directly or
indirectly references itself. Here D is a recursive list.

Chaitali Patil
Question
8

Let us consider three lists L1, L2, and L3 as


L1 = (a, b, c, d)
L2 = (a, (b), (c,d), e)
L3 = (a, ((b)), c)
Show the pictorial representation of these lists using
header node

Chaitali Patil
9

Chaitali Patil
10

Chaitali Patil
11

Chaitali Patil
12

Node structure of a generalized list

Chaitali Patil
Node structure of a generalized list
13

Chaitali Patil
Data/header node of GLL
14

Tag = 1, it indicates that the second field is


data
Tag = 0 indicates that it is the header node
where the second field holds the address of
the first node of the list member

Chaitali Patil
15

Write an ADT for GLL

Chaitali Patil
16

Chaitali Patil
Representation of Polynomials Using Generalized linked list
17

Chaitali Patil
18

Chaitali Patil
19

Chaitali Patil
20

Chaitali Patil
Representation of multi-variable polynomial as single
variable polynomial
21

Chaitali Patil
Every polynomial, regardless of the number of variables in it, can be represented
using nodes.
22

Chaitali Patil
ADT for multi-variable polynomial using GLL
23
class GLLPolyNode
{
int Tag;
union
{
char variable;
float coefficient;
GLLPolyNode *dLink;
};
int exponent;
GLLPolyNode *nLink;
};
class GLLPoly
{
private:
GLLPolyNode *Head;
public:
GLLpoly() {Head = Null;}
void InsertNode();
void PrintGLL();
}; Chaitali Patil
24

Chaitali Patil
25

Chaitali Patil
26

Chaitali Patil
Representation of Sets Using Generalized linked list
27

Chaitali Patil
Thank You

Chaitali Patil

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy