Take it as a warm suggestion: please start doing the exercises and send them in the mailing list, so as to start a discussion about them
There are no other communications so far
Donald Knuth is a Computer Scientist
Main contributions: theoretical and practical development of the analysis of the computational complexity of algorithms, The Art of Computer Programming series of monographs, TeX typesetting system for writing academic documents
The Art of Computer Programming is an ongoing work (3 volumes and an half out of 7 have been published so far)
The first volume of Knuth's series of books is entirely dedicated to a comprehensive introduction of all the basic data structures
A data structure is a way in which we can organise the information to process and returned by a computer, so as it can be accessed and modified in an efficient and computational manner
Broadly speaking, it is a sort of bucket where we can place some information, that provides some methods to add and retrieve pieces of such information
Among the simplest data structures, there are those ones that organise their element in a specific order and allow the repeatability of the values they contain
Order: the sequence in which the elements are added to these data structures matters
Repeatability: the same value can appear twice or more times in the same data structure
A list is a countable sequence of ordered and repeatable elements
Countable: it is possible to know the length of the list (i.e. how many elements it contains) – in ThyMopani, we can use the support algorithm def len(countable_object)
Ordered: the elements are placed in the list in a specific order, which is preserved
Repeatable: the elements may appear more than one time in the list
Create a new list: list()
Add new element: <list>.append(<element>)
Remove element: <list>.remove(<element>)
Add elements from another list: <list>.extend(<another_list>)
my_first_list = list() my_first_list.append(34) my_first_list.append(15) my_first_list.append("Silvio") my_first_list.remove(34) my_first_list.extend(my_first_list)
my_first_list =
34
15
"Silvio"
15
"Silvio"
A stack is a is a kind of list seen from a particular perspective, i.e. from bottom to top, and with a specific set of operations
The elements follow a last in first out strategy (LIFO) for addition and removal
The last element inserted in the structure is placed in the top of the stack and, thus, it is also the first one that will be removed when requested
For removing the element in the middle of the stack one has to remove all the elements that have been added after such middle element
Create a new stack: deque()
Add new element: <stack>.append(<element>)
Remove (and return) latest element: <stack>.pop()
Add elements from another stack: <stack>.extend(<another_stack>)
my_first_stack = deque() my_first_stack.append(34) my_first_stack.append(15) my_first_stack.extend(my_first_stack) my_first_stack.append("Silvio") my_first_stack.pop()
my_first_stack =
A queue is a is a kind of list seen from a particular perspective, i.e. from left to right, and with a specific set of operations
The elements follow a first in first out strategy (FIFO) for addition and removal
The first element is placed in the left-most part of the queue and, thus, it is also the first one that will be removed when requested
For removing the element in the middle of the queue one has to remove all the elements that have been added before such middle element
Create a new queue: deque()
Add new element: <queue>.append(<element>)
Remove (and return) first element: <queue>.leftpop()
Add elements from another queue: <queue>.extend(<another_queue>)
my_first_queue = deque() my_first_queue.append(34) my_first_queue.append(15) my_first_queue.append("Silvio") my_first_queue.leftpop() my_first_queue.extend(my_first_queue)
my_first_queue =
34
15
"Silvio"
15
"Silvio"
silvio.peroni@unibo.it 0000-0003-0530-4305 @essepuntato
Computational Thinking and Programming (A.Y. 2017/2018)
Second Cycle Degree in Digital Humanities and Digital Knowledge
Alma Mater Studiorum - Università di Bologna