Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'algorithm': 0.03; 'subject:Python': 0.05; 'binary': 0.05; 'python': 0.09; 'immutable': 0.09; 'integers': 0.09; 'lengths': 0.09; 'lookup': 0.09; 'pointers': 0.09; 'sep': 0.09; 'subject:using': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'def': 0.10; 'add(self,': 0.16; 'dictionary.': 0.16; 'elements,': 0.16; 'foundational': 0.16; 'hashed': 0.16; 'modifiable': 0.16; 'trivially': 0.16; 'tuples,': 0.16; 'wrote:': 0.17; 'element': 0.17; 'resolved': 0.17; 'python?': 0.20; 'fairly': 0.21; 'algorithms.': 0.22; 'focusing': 0.22; 'symbolic': 0.22; 'example': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'implemented': 0.27; 'tree': 0.27; 'node': 0.29; 'types.': 0.29; 'skip:_ 10': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'classes': 0.30; 'fri,': 0.30; 'basic': 0.30; 'lists': 0.31; 'code': 0.31; '(and': 0.32; 'implement': 0.32; 'shift': 0.33; 'received:google.com': 0.34; 'from:addr:googlemail.com': 0.35; 'machines': 0.35; 'received:209.85.220': 0.35; 'subject:?': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'depends': 0.36; 'level': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'mean': 0.38; 'some': 0.38; 'things': 0.38; 'instead': 0.39; 'skip:" 10': 0.40; 'your': 0.60; 'easy': 0.60; 'skip:u 10': 0.60; 'most': 0.61; 'high': 0.61; 'lower': 0.61; 'first': 0.61; 'more': 0.63; 'become': 0.65; 'person.': 0.69; 'link:': 0.75; '"remove"': 0.81; 'cc:addr:ix.netcom.com': 0.84; 'self.value': 0.84; 'textbook': 0.84; '8bit%:70': 0.91; 'dennis': 0.91; 'reasoning': 0.91 Newsgroups: comp.lang.python Date: Thu, 27 Sep 2012 04:15:55 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 123.192.32.215 MIME-Version: 1.0 Subject: Re: Algorithms using Python? From: 88888 Dihedral To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org, Dennis Lee Bieber 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: , Message-ID: Lines: 129 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348744564 news.xs4all.nl 6871 [2001:888:2000:d::a6]:34584 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30290 Wayne Werner=E6=96=BC 2012=E5=B9=B49=E6=9C=8827=E6=97=A5=E6=98=9F=E6=9C=9F= =E5=9B=9BUTC+8=E4=B8=8A=E5=8D=8812=E6=99=8205=E5=88=8631=E7=A7=92=E5=AF=AB= =E9=81=93=EF=BC=9A > On Fri, 21 Sep 2012, Dennis Lee Bieber wrote: >=20 >=20 >=20 > > On Fri, 21 Sep 2012 14:26:04 +0530, Mayuresh Kathe >=20 > > declaimed the following in gmane.comp.python.general: >=20 > > >=20 > >> Is there a good book on foundational as well as advanced algorithms >=20 > >> using Python? >=20 > >> >=20 > > Depends on what you mean by "foundational"... >=20 > > >=20 > > Since Python has dynamic lists and dictionaries, I suspect you won't >=20 > > find any textbook focusing on linked-list or hashed lookup algorithms >=20 > > using Python. >=20 > > >=20 > > You can probably implement them, but they're not going to be very >=20 > > efficient. (And never "remove" an element from the linked-list >=20 > > implementation because Python would shift all the other elements, hence >=20 > > your "links" become invalid). >=20 >=20 >=20 > It's quite inefficient, but it would be fairly trivial to create a LL=20 >=20 > implementation like this: >=20 >=20 >=20 > class Link: >=20 > def __init__(self): >=20 > self.next =3D None >=20 > self.value =3D None >=20 >=20 >=20 > class LinkedList: >=20 > def __init__(self): >=20 > self.head =3D None >=20 >=20 >=20 > def add(self, value): >=20 > node =3D Link() >=20 > node.value =3D value >=20 > self.append(node) >=20 >=20 >=20 > def append(self, node): >=20 > # Write some code >=20 >=20 >=20 > It's fairly easy to use reference types as one would use pointers in=20 >=20 > . >=20 >=20 >=20 > But it might actually require understanding pointers and such in the firs= t=20 >=20 > place... >=20 >=20 >=20 > I'm not really aware of any algorithm that's impossible/harder to=20 >=20 > implement in Python - Python just makes most things a lot easier so you= =20 >=20 > never have to deal with the lower level algorithms. Which makes *me* happ= y=20 >=20 > :) >=20 >=20 >=20 > -Wayne In python long integers of varried lengths of precesions, doubles,=20 complex numbers, immutable tuples, modifiable lists, modifiable dictionari= es, and functions and classes are all name resolved basic built in types. It is more interesting to implement a binary tree in python from=20 a dictionary. Also the set part can be implemented by long integers or dictionaries. The symbolic computation part as in sympy is also a good example=20 of high level programmings in python. But this also means a lot kids will finish their calculous homeworks=20 trivially by machines instead of reasoning and learning in person.