how we can impliment single=linked list in telephone directory
is it a good project
linked list ApplicationsI need application of linked list
Page 1 of 1
2 Replies - 3967 Views - Last Post: 05 November 2010 - 12:11 AM
Replies To: linked list Applications
#2
Re: linked list Applications
Posted 05 November 2010 - 12:01 AM
Sure it is a good project. Single-linked list is one of the easiest data structures, so implementing them is very easy too.
In Scheme, creating such a list, looks like this:
(define list (cons 1 (cons 2 (cons 3 (cons 4 empty)))))
and you can browse this list by using rest:
(rest (cons 1 (cons 2 empty)) -> (cons 2 empty)
So what function do you need? Only 3: cons, rest and empty.
cons appends an element to a list and returns the new list.
rest returns a list without the first element.
empty represents an empty list
Just with those three functions you can do a lot of cool stuff
In Scheme, creating such a list, looks like this:
(define list (cons 1 (cons 2 (cons 3 (cons 4 empty)))))
and you can browse this list by using rest:
(rest (cons 1 (cons 2 empty)) -> (cons 2 empty)
So what function do you need? Only 3: cons, rest and empty.
cons appends an element to a list and returns the new list.
rest returns a list without the first element.
empty represents an empty list
Just with those three functions you can do a lot of cool stuff
#3
Re: linked list Applications
Posted 05 November 2010 - 12:11 AM
As interesting as it might be to be told how to do this in Scheme I assume since you posted to a C/C++ forum you might be interested in how to this in C/C++. Is that right?
Here's some relevant information about linked lists in C/C++
http://www.dreaminco...-in-c-tutorial/
http://www.dreaminco...e/snippet82.htm
http://www.dreaminco...in-linked-list/
http://www.cs.bu.edu...ed-list/delete/
http://richardbowles...st/linklist.htm
Is it a good project?
Well it's a complete waste of time at a practical level.
1 - The software to handle telephone directories is mature and your version is unlikely to be good enough to supplant any of those.
2 - In real world C++ coding you would probably use one of the STL containers rather than write your own linked list.
Will doing it teach you useful stuff and extend your programming skills, yes it will.
So, depending on what you mean by 'good' the answer is either 'yes' or 'no'.
Here's some relevant information about linked lists in C/C++
http://www.dreaminco...-in-c-tutorial/
http://www.dreaminco...e/snippet82.htm
http://www.dreaminco...in-linked-list/
http://www.cs.bu.edu...ed-list/delete/
http://richardbowles...st/linklist.htm
Is it a good project?
Well it's a complete waste of time at a practical level.
1 - The software to handle telephone directories is mature and your version is unlikely to be good enough to supplant any of those.
2 - In real world C++ coding you would probably use one of the STL containers rather than write your own linked list.
Will doing it teach you useful stuff and extend your programming skills, yes it will.
So, depending on what you mean by 'good' the answer is either 'yes' or 'no'.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|