|
-
Dec 14th, 2003, 02:30 AM
#1
Thread Starter
Frenzied Member
circular linked lists
Hello
I have been programming stacks and queues, and wondering if it is possible to program a circular queue.
What problems could happen?
Steve
-
Dec 14th, 2003, 04:38 AM
#2
transcendental analytic
circular queues are most useful if their size is constant, nearly constant or don't run over certain limit. If it becomes full you need to resize it, and thats about the only concern with it, a size of power of two is ideal because then you can use the bitwise and operator to wrap around head and tail (modulus is slow and shouldn't be used, alternatively you can use ifs)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 14th, 2003, 07:57 AM
#3
Hypothetically, if I created a circular list in Managed C++ and then lost my last external pointer to the 'ring' (but the list was still intact in memory) would the GC try to collect back the memory at the end of the program or would the ring stay in RAM until system shutdown?
I don't live here any more.
-
Dec 14th, 2003, 12:12 PM
#4
Monday Morning Lunatic
GCs detect rings and remove them if they're orphaned.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 16th, 2003, 04:39 AM
#5
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|