Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: is there really no efficient way to delete an element from a list??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23977] Re: [mg23925] is there really no efficient way to delete an element from a list??
  • From: David Withoff <withoff at wolfram.com>
  • Date: Sun, 18 Jun 2000 03:01:00 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Use linked lists, as in

queue={1,{2,{3,{4}}}}
queue = Rest[queue]

Dave Withoff
Wolfram Research

> hi, i tried to implement a queue with mathematica;
> is it possible that there is no O(1) way to get
> queue = Rest[queue]  ??
> 
> it seems that mathematica uses call by value instead of call by reference
> here;
> i know that there are PrependTo[] and ApendTo[] for building the list; is
> there any equivalent to these functions to remove elements?
> 
> or is there another way to implement a stack or queue with constant time
> access?
> 
> --martin.
> 
> ----------------------------------------------------------------------------
> Martin Bauer                          email:  martin.bauer at in.tum.de
> Department of Computer Science          www:  http://www.in.tum.de/~bauerma
> Technische Universitat Munchen          tel:  +49-89-289-25724
> D-80290 Munchen, Germany               room:  3202  main bldg, Arcisstr.21
> ----------------------------------------------------------------------------


  • Prev by Date: Re: Newbie question: pairswise function application
  • Next by Date: AW: Re: Integrate returns 0
  • Previous by thread: Re: is there really no efficient way to delete an element from a list??
  • Next by thread: Re: is there really no efficient way to delete an element from a list??