Karephul
July 31st, 2006, 03:09 PM
I had a singly link list, so it was hard to traverse the link list in backward
direction, so I converted that singly link list to doubly link list so that
I can traverse it in backword direction too.
problem:
- If system traverse it for me .. like by while(current -> next != NULL)
it traverse it real fast .. according to the structure of the data in Link List
struct data
{
time t;
data *next
}
where is the key "time" to take care of speed of the traversal. while traversing, I can get the time from system and for every one second say.
will increment only those lists whose time is less that what I just generated
so, I will put a hold to those "data" structs whose time is greater than what
is NOW according to the program.
algo: psydo code
struct data
{
time t; // this is integer type
data *next;
}
start
1. make diffent link lists say 10;
2. each list list node has diffeent "time" associated with it.
-- This shows that if I travers all the lists together and say I have the
list like :time 1:-: time 1.5:-:time 2.0:-: ..............
and second list like
:time 2:-: time3:-:time:-4: ...........
that means while traversing i will only get node :time2: when time1, time1.5 of the first list is passed.
Who can do this by time, say if i can get the system time .. but problem is
when I will reverse, what will happen to the time ?? so I need to fuctionalty
of FWD, REV, FWD , PAUSE at the same time .,,, taking care of TIME.
Any Idea, Psudo code will be fine too..
Thanks
direction, so I converted that singly link list to doubly link list so that
I can traverse it in backword direction too.
problem:
- If system traverse it for me .. like by while(current -> next != NULL)
it traverse it real fast .. according to the structure of the data in Link List
struct data
{
time t;
data *next
}
where is the key "time" to take care of speed of the traversal. while traversing, I can get the time from system and for every one second say.
will increment only those lists whose time is less that what I just generated
so, I will put a hold to those "data" structs whose time is greater than what
is NOW according to the program.
algo: psydo code
struct data
{
time t; // this is integer type
data *next;
}
start
1. make diffent link lists say 10;
2. each list list node has diffeent "time" associated with it.
-- This shows that if I travers all the lists together and say I have the
list like :time 1:-: time 1.5:-:time 2.0:-: ..............
and second list like
:time 2:-: time3:-:time:-4: ...........
that means while traversing i will only get node :time2: when time1, time1.5 of the first list is passed.
Who can do this by time, say if i can get the system time .. but problem is
when I will reverse, what will happen to the time ?? so I need to fuctionalty
of FWD, REV, FWD , PAUSE at the same time .,,, taking care of TIME.
Any Idea, Psudo code will be fine too..
Thanks