Archive for March, 2008

Algoritmo Ricorsivo

Sunday, March 30th, 2008

Da canticchiare sulla base di Disco Labirinto dei Subsonica & Bluvertigo..

Algo Ricorsivo

Quasi quasi lo direi
Quasi quasi scrivilo
Quasi quasi ti ho capito
E mi sono rovinato
Quasi quasi non ti seguo
Quasi quasi ho il vomito
Quasi quasi Ω(esagero)
..E non compilarono..

Vorrei un algoritmo ricorsivo
Bianco senza cicli colorati
Lungo un centinaio di righe
Dal quale non si possa uscire
Vorrei un algoritmo ricorsivo
Bianco senza strane invarianti
Con un centinaio di strutture
Per le quali non si riesca a dormire

Quasi quasi ascoltami (training autogeno)
Quasi quasi ti risolvo (senza nessun aiuto)

Vorrei un algoritmo ricorsivo
Bianco senza master theorem
Pesante un centinaio di kilobyte
Per i quali non si possa scrivere
Vorrei un algoritmo ricorsivo
Bianco senza loop infiniti
E quel centinaio di birre
Che non posso ancora bere

Precise, Precise, Precise, Precise, Precise, Precise

Vorrei un algoritmo ricorsivo
Bianco senza tante condizioni
Con un centinaio di complessità
Le quali neanche definibili
Vorrei un algoritmo ricorsivo
Bianco senza if annidati
Con un un centinaio di cicli
Per i quali non si riesca a leggere

Vorrei un algoritmo lineare

Chiedo ufficialmente scusa ai Subsonica e ai Bluvertigo (e loro fan), ma queste 10 ore e 25 minuti di uptime del mio portatile sono servite a capire, implementare e calcolare la complessità asintotica dell'Heapsort, worst e best case, dimostrarle, vedere che succede passandogli array già ordinati come input.
Sembro già meno pazzo ora, vero?

  • Share/Save/Bookmark

Una giornata perfetta..

Tuesday, March 25th, 2008

Ieri è stata una giornata fantastica, dall'inizio alla fine..
..mattina e pomeriggio presto con la mia piccola..
..pomeriggio fino a sera a finire di sistemare alla perfezione la mia vps, abilitando pop3, smtps, https..
..la sera vengo a sapere di aver fatto stare male qualcuno che si merita solo di stare male..
..la sera tarda birra con un amico..

Dovrebbero essere tutte così le giornate..

Ah si, e ora pure questa:

vps ~# uptime
10:00:24 up 15:28, 2 users, load average: 0.00, 0.00, 0.00

Speriamo continui così :)

  • Share/Save/Bookmark

Un Arrivederci ed un Buongiorno

Friday, March 21st, 2008

Oggi se ne va un grande amore, la mia Grande Punto :( i nonni tornano dall'Africa e quindi gliela devo restituire.. Si soffre, si soffre.. è un arrivederci.. almeno fino a quando non ci ritornano..

..però..sempre e proprio oggi..ne è arrivato uno nuovo? :D Chissà..

  • Share/Save/Bookmark

Object Oriented Memory Management

Wednesday, March 19th, 2008

Major Update on 10th April 2009, inclusion of C++ programming language!
Updated on 18th April 2008, a complete example on stack and heap
Updated on 15th April 2008, new contents and new layout!
Updated on 6th April 2008, new contents!

The paper you can download from here is about a model for memory management during the execution of programs written in Java and C++.

It started on March, 2008 as a summary of the lecture notes of both the "Programming Project" and
"Software Engineering Project" courses held by professors of the CASE (Center for Applied Software Engineering) of the Free University of Bolzano - Bozen.

The first versions of this publication were only about Java memory management.
Subsequent revisions added information found on other sources. Unfortunately, the author forgot to
reference the sources on the document.

On March, 2009 the author began to add the information about C++ programming language. More
information from other sources were added, including their attribution.

The biggest source of this document is still the set of presentations of CASE.
The code snippets and their corresponding stack/heap diagrams are copied in full from those of the
slides.

The next major revision will contain original images (not belonging to CASE slides), as well as other code
snippets that I could find more clear than those of CASE.

If you find that this document contains information taken from one of your publications, please
contact the author, that is willing to either delete them from this document or to add an attribution to
your work.

Download the PDF of the summary

Table of Contents:

  • The model
  • Code load and execution
  • Activation Record (AR)
  • Contents of the Activation Record
  • Abbreviations for
  • Declaration vs. Definition
  • The scope of a variable
  • Extent of a Variable
  • Blocks
  • Scope Activation Record (SAR)
  • Example on SAR
  • Role of SLs
  • Dynamic Memory Allocation And Handling
  • Dynamic Vs. Static memory allocation
  • Dynamic Memory Scope and Extent
  • Accessing dynamic memory
  • Classes
  • Objects
  • Object instantiation
  • Objects in Memory (Java)
  • Objects in Memory (C++)
  • Memory Management issues (Java)
  • Memory Management issues (C++)
  • Methods
  • Methods (Java)
  • Methods (C++)
  • Attributes
  • The null value (Java)
  • The NULL value (C++)
  • Parameter
  • Parameter Passing (Java)
  • Example of parameters passing (Java)
  • Example of parameters passing (Java), continued
  • Parameter Passing (C++)
  • Example of parameters passing by value (C++)
  • Example of parameters passing by reference (C++)
  • Pointers vs. Parameters (C++)
  • Previous example using pointers (C++)
  • Constructor
  • Inline initialization
  • A constructor's call (Java)
  • Class attributes
  • Example of class attributes (Jav)
  • Example of class attributes (C++)
  • Class Method
  • Example of Stack/Heap Diagrams in Java
  • Code
  • Stack Diagram
  • Heap Diagram
  • Memory portions assigned to a program (code area, heap / dynamic memory area), execution stack
  • How code is loaded in Java
  • The Activation Record (AR) and function calls
  • Abbrevations (AR, RV, RA, SP, N/E, @, ??, arb)
  • Examples on method calls and activation records usage
  • Declaraion vs. Definition of a variable, the scope of a variable, blocks
  • Scope Activation Record (SAR), Static Link (SL), the role of SL
  • The extent/lifetime of a variable
  • Dynamic memory allocation and handling
  • Dynamic vs. Static memory allocation
  • Dynamic memory scope and extent
  • Accessing dynamic memory
  • Classes and Objects in detail, object instantiation
  • Memory Management issues
  • Objects vs. Variables (definitions)
  • Methods of Objects
  • Class Attributes
  • The null value
  • Parameters (formal, actual), parameters passing (by reference, by value)
  • Constructors and Inline Initialization
  • Constructor's call
  • Class attributes (static variables)
  • Class methods (static methods)
  • Complete Example of Stack/Heap Diagrams

Everything is integrated with simple examples.

Download the PDF of the summary

  • Share/Save/Bookmark

Me and a boring lecture

Wednesday, March 19th, 2008

And THIS is what happens if you try to imprison and to teach a Computer Science student:

Daniel Graziotin bored during a lecture at LUB/FUB

Yep, my happy face simply says:"Look such an idiot, professor! I'm so boooooreeeed"

  • Share/Save/Bookmark

Two IT guys and DSA assignments

Sunday, March 16th, 2008

This is what happens if you give to two IT students a stressful assignment of "Data Structures
and Algorithms", 48 hours of their meaningful life, the loss of a saturday night, and the 6th
floor of the most recent building of the Free University of Bolzano:

IT Guys habitat in unibz

..they begin to behave like real IT guys..and to build their ideal working habitat..

Habitat of two IT guys Data Structures and Algorithms Assignment DSA

..and to worship fake idols..

Forno Damiani Free University Bolzano

  • Share/Save/Bookmark