linked list Applications

I need application of linked list

Page 1 of 1

2 Replies - 10124 Views - Last Post: 05 November 2010 - 12:11 AM Rate Topic: -----

#1 arunarjunan   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-November 10

linked list Applications

Posted 04 November 2010 - 11:48 PM

how we can impliment single=linked list in telephone directory
is it a good project
Is This A Good Question/Topic? 0
  • +

Replies To: linked list Applications

#2 Djabby   User is offline

  • D.I.C Head

Reputation: 37
  • View blog
  • Posts: 131
  • Joined: 02-November 10

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 :)
Was This Post Helpful? 0
  • +
  • -

#3 janotte   User is offline

  • code > sword
  • member icon

Reputation: 991
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

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++

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'.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1