Re: Decent datastructure for queue operations



One way is to write a structure that holds a list L together with a
pointer p to the last cons in the list. To add an item,
(setf (cdr p) (list new-item))
(pop p)
To remove an item,
(pop L)
You'd also have to handle p when L is empty.

.



Relevant Pages

  • Re: Converting enums to pointers
    ... > You declare EMPTY to be a null pointer here. ... though it might be nice to use the extern keyword. ...
    (comp.lang.cpp)
  • [BUG -rt] Double OOPs - thread_info free race / printk recursive lock
    ... vmcore produced by kdump suggests two problems: ... An invalid pointer dereference in cache_flusharraywhich causes the page ... As part of a call back, we are attempting to free a task structure. ... prev = 0x0 ...
    (Linux-Kernel)
  • Re: Insert symbol between every element in a list (From HtDP book)
    ... symbol empty) empty)] ... (cons (cons a-symbol (first a-list)) ... (insert-everywhere a-symbol (cons (first words) ...
    (comp.lang.scheme)
  • Re: basic_string ctor
    ... > and a NULL pointer both construct a std::string as empty. ... than likely I'm converting something from a GUI layer to a standard ... as anything but an empty string. ...
    (microsoft.public.vc.stl)
  • Mouse Pointer Becomes 4-Way Arrow and Wont Revert
    ... In WinXP Home SP1, my mouse pointer occasionally becomes a 4-way arrow and ... will not revert to a regular pointer unless I go to the mouse properties ... PCI 1: Empty ... Firewall: Kerio Personal Firewall 2.1.4 ...
    (microsoft.public.windowsxp.help_and_support)