Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin.stu.neva.ru!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'algorithm': 0.03; 'subject:Python': 0.05; 'python': 0.09; 'lookup': 0.09; 'pointers': 0.09; 'sep': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'add(self,': 0.16; 'elements,': 0.16; 'foundational': 0.16; 'hashed': 0.16; 'wrote:': 0.17; 'element': 0.17; 'python?': 0.20; 'fairly': 0.21; 'algorithms.': 0.22; 'focusing': 0.22; 'cc:2**0': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'node': 0.29; 'skip:_ 10': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'fri,': 0.30; 'lists': 0.31; 'code': 0.31; '(and': 0.32; 'implement': 0.32; 'shift': 0.33; 'subject:?': 0.35; "won't": 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'depends': 0.36; 'charset:us-ascii': 0.36; 'level': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'mean': 0.38; 'some': 0.38; 'things': 0.38; 'skip:" 10': 0.40; 'your': 0.60; 'easy': 0.60; 'skip:u 10': 0.60; 'most': 0.61; 'lower': 0.61; 'first': 0.61; 'become': 0.65; 'link:': 0.75; '"remove"': 0.81; 'from:addr:wayne': 0.84; 'self.value': 0.84; 'textbook': 0.84; 'dennis': 0.91 Date: Wed, 26 Sep 2012 10:55:47 -0500 (CDT) From: Wayne Werner X-X-Sender: wayne@gilgamesh To: Dennis Lee Bieber Subject: Re: Algorithms using Python? In-Reply-To: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348675519 news.xs4all.nl 6842 [2001:888:2000:d::a6]:45765 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30219 On Fri, 21 Sep 2012, Dennis Lee Bieber wrote: > On Fri, 21 Sep 2012 14:26:04 +0530, Mayuresh Kathe > declaimed the following in gmane.comp.python.general: > >> Is there a good book on foundational as well as advanced algorithms >> using Python? >> > Depends on what you mean by "foundational"... > > Since Python has dynamic lists and dictionaries, I suspect you won't > find any textbook focusing on linked-list or hashed lookup algorithms > using Python. > > You can probably implement them, but they're not going to be very > efficient. (And never "remove" an element from the linked-list > implementation because Python would shift all the other elements, hence > your "links" become invalid). It's quite inefficient, but it would be fairly trivial to create a LL implementation like this: class Link: def __init__(self): self.next = None self.value = None class LinkedList: def __init__(self): self.head = None def add(self, value): node = Link() node.value = value self.append(node) def append(self, node): # Write some code It's fairly easy to use reference types as one would use pointers in . But it might actually require understanding pointers and such in the first place... I'm not really aware of any algorithm that's impossible/harder to implement in Python - Python just makes most things a lot easier so you never have to deal with the lower level algorithms. Which makes *me* happy :) -Wayne