User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 456,504 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,683 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Legacy and Other Languages advertiser: Programming Forums
Views: 1432 | Replies: 3
Reply
Join Date: Sep 2007
Posts: 1
Reputation: lsprog is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lsprog lsprog is offline Offline
Newbie Poster

Question How to implement heap in lisp?

  #1  
Sep 27th, 2007
I am trying to implement heap in CLisp. I have already done it by makin a linear data strcuture with no left / right pointers. But now I want to use a nested list format which contains (el () ()) at the highst level.
The problem I am facing with is how to define a recursive case for insertion. Heap requires the tree to be complete.

I approach the issue as follows:

1. I will take a heap and an element
2. I will add the element in the last node keeping it a complete tree
3. I wil swap the child with parent if it is greater than the parent

But I am stuck at the second step i.e. how to add an element without making the tree incomplete? KIndly help me on this!!!!!!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 145
Reputation: hopalongcassidy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 13
hopalongcassidy's Avatar
hopalongcassidy hopalongcassidy is offline Offline
Junior Poster

Re: How to implement heap in lisp?

  #2  
Oct 23rd, 2007
LISP????

Yuch!!!

Hoppy

P.S. I hate Lisp!
Reply With Quote  
Join Date: Aug 2005
Location: London, Ontario, Canada
Posts: 71
Reputation: indienick is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
indienick's Avatar
indienick indienick is offline Offline
Junior Poster in Training

Re: How to implement heap in lisp?

  #3  
Dec 10th, 2007
Way to beef up your post count, hopalongcassidy. If you hate Lisp so much, then avoid any thread with "Lisp" or "Scheme" in the title.

Sheesh.

I'm sorry for that lsprog.
I haven't done much mucking about with stack and heap programming in Common Lisp. When you mention "CLisp" do you mean GNU Clisp - the REPL? Or are you referring to Common Lisp?

As far as my programming experience has taught me, mucking about with stacks and heaps is reserved for the language handler (interpreter/VM/whatever-else-you-want-to-call-it). Would you be able to show me a bit of code, and I will more than try my hardest to help you.
Angel-headed hipsters burning for the ancient heavenly connection, to the starry dynamo in the machinery of the night.
-Ginsburg

Don't tell me to "google it" - I already have.
Reply With Quote  
Join Date: Oct 2007
Posts: 145
Reputation: hopalongcassidy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 13
hopalongcassidy's Avatar
hopalongcassidy hopalongcassidy is offline Offline
Junior Poster

Re: How to implement heap in lisp?

  #4  
Dec 10th, 2007
Originally Posted by indienick View Post
Way to beef up your post count, hopalongcassidy. If you hate Lisp so much, then avoid any thread with "Lisp" or "Scheme" in the title.



Boy,. I didn't know I would strike such a nerve. I guess I would be sensitive too if I was constantly trying to keep an arcane language from going extinct.

Hoppy
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Legacy and Other Languages Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Legacy and Other Languages Forum

All times are GMT -4. The time now is 3:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC