0% found this document useful (0 votes)
25 views42 pages

Idsa U1 Intro DT DS 2021s2

Uploaded by

cemoxe8465
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views42 pages

Idsa U1 Intro DT DS 2021s2

Uploaded by

cemoxe8465
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Unit 1:

Introduction to Data Structures and Algorithms (IDSA)

CCIT 4016, 2021-2022


2
• Computer program includes data and instructions used to operate a
computer and produce a specific result
– Studying Programming focuses on how to solve programming problems.
– In our course “Introduction to Computer Programming” (ICP), we much
focus on finding solution to solve a given problem, with skills and knowledge
of programming, based on some programming languages, Python.

• Studying Data Structures and Algorithms (DSA) focuses on how to


solve programming problems BETTER.
– Our course “Introduction to Data Structure and Algorithms” (IDSA) helps us
to know and determine what programming algorithms or “approaches” with
properly structured data may work better, analyze and create these
programs, with concepts and skills learnt in the course.

• In the future, based on what we have learnt in this course, we may


come up with our own algorithms or structures to solve real problems
better.
3
Programming vs Data Structures and Algorithms

• As many techniques of Data Structures and Algorithms (DSA) are so


important and popular, some of them have already been implemented
in certain ways in many programming languages and platforms, such
as the type list in Python.
– Python class type list is a well-developed data type, with certain data
structure supporting many useful operations, e.g. methods (operations) of
list such as list.append(x) , list.insert(i, x) or
list.remove(x) may support different applications.

• Our course requires students to learn and “re-implement” some of


them, and thus students may find we are “re-doing” them in our own
way.

4
Programming vs Data Structures and Algorithms

• As many techniques of Data Structures and Algorithms (DSA) are so


important and popular, some of them have already been implemented
in certain ways in many programming languages and platforms, such
as the type list in Python.
– Python class type list is a well-developed data type, with certain data
structure supporting many useful operations, e.g. methods (operations) of
list such as list.append(x) , list.insert(i, x) or
list.remove(x) may support different applications.

• Our course requires students to learn and “re-implement” some of


them, and thus students may find we are “re-doing” them in our own
way.

5
Data Structures and Algorithms – A Short Note

Relating to Computer Science and computer programming:

• Data structure focuses on structuring and modelling data types of


specific logical structures/relations in certain physical structure/form
(certain way for implementation) with related operations, so that it
could support better algorithms and performance of achieving certain
tasks / functions (e.g. for handling massive amount of records).
– E.g. Implementing List (logical) structure with Array-based or Linked
(physical) structure, where they are called Array-List or Linked-List
respectively.

• It is much related to define and implement a new programmer-defined


data type with 1) a set of data related values, 2) the operations we
may apply to these data, and even 3) the structuring of these data
values for better operations when implementing them.

• Developing a new data type often starts with Abstract Data Type
(ADT), designing the type we wanted before actual implementation.
6
Data Structures and Algorithms – A Short Note

• Algorithm focuses on finding ways to achieve a task with a finite step-


by-step list of well-defined instructions

• One programming task may be solved by different algorithms, with


different performances (e.g. in terms of computer resources, evaluated
with time complexity)

• Common examples include sorting and searching tasks in a massive


data collection

* This topic will be further discussed in later unit.

7
Data Structures and Algorithms – A Short Note

• Different programming tasks require different supports from the areas


of Data Structures and Algorithms.

• Example Task 1: Build a program to find factorial (n!=1*2*..*n)


and triangular number (1+2+..+n) of an input number ( n ) , and
display the result in certain way. There are different approaches to
finish this task, and we may select a better one:
– Use external function (say, in the standard library) if it is there. Is it easy
to use? Is it fast enough to finish the task?
– Use your own way (with what the programming language provides, in case
of no external or standard library function supports, or somehow we want
an even better one.)

• This task is much related to algorithms, ways of finishing the same


task in different performances.
– Faster? Fewer memory required? Easier for coding? Etc.
– What about data structure?
8
Data Structures and Algorithms – A Short Note

• Example Task 2: Build a program to store and process massive


data, e.g. a large number of student records, which can support better
operations of inserting, deleting, soring, searching elements and other
processing works.
Student ID Student Name Year of Study … … … …
2010000001 AU A. A. 2010 - 2011 … … … …
2010000002 CHAN C. 2010 - 2012 … … … …
2010000003 HO H. H. 2010 - … … … …
… … … … … … …
2020333333 AU A. A. 2020 - … … … …

• This much focuses on data structure, which further leads to different


associated algorithms applied to support better operations to
manipulate those structured data such as data sorting and searching.
– How do we structure and store data records “properly”, especially for
better manipulation (e.g. sorting and searching elements)?
– And thus, what data structure with proper operations (supported by
various algorithms) could do the work “better”?
9
• Data are essentially values of certain kinds or types.
– In computing, data are often represented by individual or sequence of
character symbols, numerical symbols, or other special symbols that people
use to describe the real world entities or activities.
– For example, texts of a story, numbers of temperature, symbols of emoji
and music notes can all be considered as data.

• Data Type in computer programming includes a set of related data


values (of the same type/kind). It is also associated with a set of
operations applied to these data values, and much related to how these
data values are structured for better operations. Thus, understanding,
implementing and defining data type focuses on
– the set of related data values,
– the operations we may apply to these data values, and further,
– the structuring of these data values for better operations when
implementing them (especially to composite data types).

10
Data and Data Type

• Different data types could be defined and implemented in different


programming languages.
– Some of them are build-in by the languages, some are predefined in
standard libraries, and some are defined by programmers (called
programmer-defined or user-defined data types).

• Data types are often categorized into simple data types and
composite (or structure, aggregate, complex) data types.

• Simple data types consist of data values that cannot be further


decomposed/divided into smaller parts/elements in a meaningful way.
They could be regarded as the most primitive basic form.
– They are also called primitive type in computer programming (some build-
in types of certain programming languages are often simple data types)
– E.g. int or float type in Python are simple data types:
• Represents a set of simple numeric values
• Both could be manipulated with the arithmetic operation sets such as
addition + and multiplication *. 11
Data and Data Type

• Composite (or structure) data types consist of data values that can be
further decomposed/divided into smaller parts/elements of other types.

• E.g. Build-in type list in Python is a composite data type:


– Represents a sequence of elements, each element / item can reference to a
value of certain types. E.g. a list of integer elements.
index 0 1 2 3 4 5 6 7 8 9 10
item 2 3 8 18 20 21 25 26 38 69 80

– Python list type provides a set of operations (methods) such as


append() to add element at the end, and clear() to remove all the
elements from the list.

• To develop software programs for specific tasks, very often we need to


define our own composite data types to model and represent certain
complex entities, e.g. student records.
– We then design and implement our own composite data types, say with
Python class StudentRecord. Each student record may consist of student
id, name, age, etc. 12
Data and Data Type

• Furthermore, it is also common that an element of a composite data


type can be of another composite type when designing more complex
software models or classes

• E.g. Modelling a list of student records in our course with a composite


type class SRList, where each element in SRList is also a composite
type of StudentRecord.
– Operations for these composite data type should also be considered
including their efficiency of execution, such as implementing a search
method to search a student from the SRList list in a reasonably short time.
Course
IDSA
index 0 1 2 3 4 5 6 7 8 9 10
SRList (of
students) item

Student 1 Student 2 Student 11


2000, Amy, 18 2001, Betty, 19 2010, Peter, 18

13
• Given a set of data elements K, Data Structure can be represented
by a binary tuple in a formal mathematical sense.
D = (K,R)
• D is a data structure, consists of a set of data elements K and a set of
(logical) relations R on K, where
K = { ki | 1≤i≤n }
and
R = { rj | 1≤j≤m }
• Data element ki is the i-th element of K. The number n is the total
number of data elements of K.

• Relation rj is the j-th (often binary) relation on K. The number m is the


total number of relations of R.
– If m=0 and R is an empty set, then all data elements are independent.
14
Formal Representation of Data Structure

• One (binary) relation R on K is a set of ordered-pair such that


R = { <x,y> | x∈ K, y∈ K }
• For a <x,y>, x is called the (direct) predecessor of y and y is called
the (direct) successor of x.

• If a data element does not have a predecessor, it is the “head”.

• If a data element does not have a successor, it is the “terminal”.

• If <x,y>∈ R implies <y,x>∈ R, then the pair can be represented


by (x,y).

* Remark:
• { } symbols represents a set (collection) of unique elements.
• ∈ symbol represents “belongs to” or “is an element of”.
• Our course focuses on “binary” relation in data structure.
15
Formal Representation of Data Structure
(An Example)
• In the student table below, use k1 to k5 to represent student records,
the linear data structure can be represented by
D = (K,R)
where
K = { k1 , k2 , k3 , k4 , k5 }
and,
R = { <k1,k2>, <k2,k3>, <k3,k4>, <k4,k5> }

k1
k2
k3
k4
k5

* Remark: For simplicity, in this example (and the rest in our course), we assume there
exists only one relation R in K, unless further specified. 16
Formal Representation of Data Structure
(Linear Structure)
• The data structure below is called a Linear Structure (as a linear List
of Data):
DL = (K,R)
where,
K = { A, C, B, E }
and,
R = { <A,C>, <C,B>, <B,E> }

Figure: A linear data structure.

17
Formal Representation of Data Structure
(Tree Structure)
• The data structure below is called a Tree Structure (a Non-Linear
Structure):
DT = (K,R)
where,
K = { a, b, c, d, e, f, g }
and,
R = { <a,b>, <a,c>, <b,g>, <c,d>, <c,f>, <c,e> }

Figure: A tree data structure.

18
Formal Representation of Data Structure
(Graph Structure)
• The data structure below is called a Graph Structure (a Non-Linear
Structure):
DG = (K,R)
where,
K = { AD, CI, FT, IE, KE, KW }
and,
R = {(KE,KW),(KE,CI),(KE,IE),(KE,AD),(IE,FT),(AD,FT)}

Figure: A graph data structure. 19


Formal Representation of Data Structure

• As these data structures are formally represented as a set of data


elements and their logical relations, this formal data structure is often
called logical data structure or logical structure.
– The same set of data elements can be associated to different relations and
form different logical data structures.

• For example, the same set of data may form


– a linear structure (say a simple list of employee records), or
– a tree structure of employee records representing members in charge of a
large project group, and subgroups.

Figure: A linear data structure.


Figure: A tree data structure.

20
• We are often required to define data types in computer programming to
model specific logical data structures such as List or Tree structures.

• When we implement them as data types, data structure in computing


further focuses on finding effective ways to store the data elements with
proper physical structure into computer memory, such that proper
operations can be defined and implemented for efficient processing
while logical structure among data elements can also be reserved.

• Two important forms of physical data structures in computing are:


– Array Structure: The basic form of sequence container used to store and
access a sequence of data based on sequential neighboring memory
11 3 6 - - -

– Linked Structure: Structure formed with “node-based-elements” which are


logically-linked sequentially together, and the nodes could be stored in
memory randomly. Head Tail

11 3 6 -
21
Data Structure and Data Type in Computing
Address Data
• Array Structure: Data stored in sequential . . . ...
neighboring memory 11 3 6 - - - 40160000 11

– Fast for direct access: locate, read and update 40160001 3


40160002 6
(e.g. with index number)
40160003 -
– Slow to insert and delete which changes structure 40160004 -
(many elements shifting / movement required) 40160005 -
. . . ...
• Linked Structure: Logically-linked “node- . . . ...
based-elements” 40162000 11
40162001
– Each data element is embedded in a node, which 40166038
. . . ...
could be randomly located in memory
. . . ...
– Elements are logically connected with links 40162022 6

– Slow to direct access: locate, read and update 40162023 -


. . . ...
– Fast to insert and delete (no elements shifting /
40166038 3
movement required) 40166039 40162022
Head Tail
. . . ...

11 3 6 - Example of Memory holding


differently-structured data 22
Data Structure and Data Type in Computing
• Data Type (DT) vs. Data Structure in computing:
– Data Type (DT, Language-dependent): a set of related data values (with
logical structure / relation) and the associated operations implemented in
specific programming languages and platforms.
• E.g. In Python, there are simple (primitive) data types int and float
for numbers, or composite data type list (based on List structure).
– Data Structure in computing (DS, implementation-specific but language-
independent): focuses on physical representation (way of implementation)
of data type based on specific formal / logical structure or relations.
• Different physical structures in implementation affect efficiency and
performances of various operations.
• This is particularly important in composite data types.
• E.g. We may implement our own data type based on the same
formal/logical List structure with different physical structures, such as 1)
using Linked physical structure to handle tasks required frequent
locating elements or 2) using Array-based physical structure to handle
tasks required frequent inserting element respectively.

* More details will be given in the coming units. 23


• Aim: To acquire a foundational understanding of problem-solving
techniques using procedural abstraction, data abstraction, data
structures, and various algorithmic approaches.

• Intended Learning Outcomes (ILOs):


– describe various problem-solving techniques such as recursions, divide-and-
conquer, backtracking, and others;
– explain various fundamental abstract data types (ADTs), such as lists,
stacks, queues, trees, and graphs, and their applications;
– implement the ADTs of list, stack, and queue, and use the structures to
solve practical problems;
– explain different strategies and algorithms for the problems of sorting and
searching;
– analyze performance of an algorithm.

• Students are STRONGLY recommended to download the course document of


our course from the learner portal, for reference
24
Our Course – IDSA

• Schedule and Duration:


– Total 12 lessons, 3 hours per lesson.
– Attendance will be taken, but will not be counted towards your grades
• However, students should take care of their own learning progress
properly, particularly our course schedule and the assignment deadlines

• Platform: Our college SOUL System


– https://soul2.hkuspace.hku.hk/
– Course materials will be available on SOUL, according to our schedule.
– Release and Submission of assessment works via SOUL: may include
• Online (SOUL-Quiz feature) assignment
• Coding and Programming assignment
• Written assignment

• Python programming language is required, and used in our course.


– Students should have enough Python programming background and have
finished our Introduction to Computer Programming (ICP) course. 25
Our Course – IDSA
(Assessments, 2021-2022 Sem. 1)
• Continuous Assessment carries 100% of the whole course.
– There will be 4 assignments. Each carries 15 % of the whole courses.
Details of the assignments will be given accordingly.
• Assignments help you understand the course materials, and feedback
how much and deep you have understood.
– The End-of-Term Assessment (ETA) carries 40% of the course.
• It is the “final” assessment on your learning outcomes.
• It may be done “closed-book”, online with video recording required.
– Students may be randomly picked and asked to explain their submitted
assessment works.

• Follow given instructions and guidelines:


– Also follow specific instructions given by individual class teacher.
– Students must finish assessment works based on concepts and techniques
learnt in our course, unless specified.
– Do not use methods of Python’s list (such as list.append() etc.),
inheritance in OOP, or other non-taught approaches in our course, unless
specified. 26
Our Course – IDSA
(Recommendation)
• For our course, students should:
– Review our “Introduction to Computer Programming” (ICP) course
materials if necessary, especially the concepts of basic programming and
multiple functions in procedural programming approach, as we expect our
students have properly finished the ICP course.
– Have Python installed and setup properly in your own computer at home,
before lesson 1 if you can. Follow installation instructions in official
website, our lecture or lab manual for information.
– Preview the course materials of each coming lesson if the materials are
released in advance. Write down any questions you want to discuss in
the coming lesson.
– Review the course materials of each lesson after finished. Write down
any questions and raise them in the next lesson for discussion.
– Keep checking your college email account and the SOUL platform
regularly, in case of any updated announcement / notice of our course.

27
• Using Python Interpreter (current version 3.10.x)
– Although there is an interactive mode of using Python interpreter, our
course focuses on running our program with Python files *.py

• Importance of indentation (NOT using braces {} for code blocks)


– Each indentation within each block must be consistent, 4-spaces per level
recommended (sometimes 2-spaces if code lines are long)

• Nature of Data types and Variables


– A variable is defined/created, when we first assign a value to it.
– NO declaration of variables required, before using
• NO need to declare (tell in advance) the data type of a variable
• Variables simply are references, pointing / referencing to values of
certain data types

• Comments
– One line comment, starts from hash symbol # to end of line
• Some may use a pair of triple-quotes for comments with multiple lines 28
Basic Python Programming Skills Required
(Basic Data Type, Expression, Statement, Control Flows)
• Basic Build-in types and functions
– int, float, str
– None in Python is a constant, referring to absence of a value (similar to
null in other languages)
– list in Python, and elements indexed with first index 0; e.g. aList[0]
– range(6) produces a sequence of 0,1,2,3,4,5
– range(1,6) produces a sequence of 1,2,3,4,5
– range(1,6,2) produces a sequence of 1,3,5

• Basic program structure


– Expression (yields a resultant value), e.g. 4+3*2 yields a result 10
– Statement, without semi-colon symbol ; required
• May sometimes be used in very short statements, for convenience
– Block of codes, including multiple lines with same indentation.

• Control flow
if-elif-else, while, for, break 29
Basic Python Programming Skills Required
(Procedural Programming and Abstraction: Functions)
• Self-defined Function (procedural approach): General Syntax
– Body of function are properly indented
• 4-spaces per indentation (and sometimes 2-spaces) are preferred
– Parameter list and return statement are optional

def <functionName> ( <parameter list> ):


<statement_1>
..
<statement_n>
<return retValue>

30
Basic Python Programming Skills Required
(Procedural Programming and Abstraction: Functions)
• Define and use Multiple Functions (Procedural Programming):
# mFn.py
def funSum(para1, para2): # a function
return para1+para2 # function with specified return value

def funDoNothing(): # another function


pass # do nothing here, but fulfill the syntax requirement

def main(): # a function main, normally for start program


aResult = funSum(12, 21) # call a function
funDoNothing() # call another fn.
print(f" Sum result is {aResult}") # call build-in fn.

# below, avoid execution if import only


if __name__ == "__main__":
main() # call main() function, to start executionmain()

* Remark: It is expected that students should be able to understand and follow the code, and
how this program executes (especially the multiple-functions definition and application).
Ignore the actual meaning and purpose of what this demonstrative example program works
for.
31
Basic Python Programming Skills Required
(Basic Object-Oriented Approach, with classes and objects)
• Our course is NOT focusing on Object-Oriented (OO) programming
approach in details (but requires the very basic OO programming skill
in Python)

• It helps if we have basic understanding of “simplified” UML class


diagram (below), representing how to model a class in OO approach
– UML class diagram is formed with a rectangle having 3 portions
• Class Name at the top portion Class Name
• Fields in the middle
Fields
– Representing data states or properties of objects (Attributes,
– Also called instance variables, or data members properties,
data members)
• Operations at the bottom portion
Operations:
– Constructors
Constructor
– Methods (functions of individual objects) Methods

32
Basic Python Programming Skills Required
(Basic Object-Oriented Approach, with classes and objects)
Class
• Python uses the following syntax to define a class:
Fields
class ClassName: # class header
Constructor
def __init__(self <more parameters>): Methods
Class Body: # constructor body
properly # fields or attributes are often defined here
indented def methodName(self <more parameters>):
# method body

• Class definition includes class header and class body


– Class header is a code to define a new class. the class name is preceded
by the keyword class and followed by a colon (:)
– Class body are the codes that are indented below the class header.
• Class body defines fields and operations (constructor and methods)
of the class required
• Basic syntax of constructor and methods of a class is similar to that of
functions in Python.
• Fields are often defined inside the constructor. Self-defined Class
(object-oriented approach): Basic Syntax
33
Basic Python Programming Skills Required
(Basic Object-Oriented Approach, with classes and objects)
• Define and use Classes / Objects (Object-Oriented Programming OOP):
# DSAClass.py DSAClass
class DSAClass: # defining a class aField
__init__()
def __init__(self): # the constructor / Initializer methodSum(par
a1, para2)
self.aField = 33 # a field

def methodSum(self, para1, para2): # a method


return para1 + para2 + self.aField

def main(): # a function main, normally for start program


anObj = DSAClass() # create object, & call constructor
aResult = anObj.methodSum(12, 21) # call method of obj
print(f" Certain result is {aResult}")
bObj = DSAClass() # create another object of type DSAClass

main() # call main() function, to start execution


* Remark: It is expected that students should be able to understand and follow the code, and
how this program executes (especially the class definition and its application with objects).
Ignore the actual meaning and purpose of what this demonstrative example program works for.
34
Basic Python Programming Skills Required

• Common Conventions (not rules):


– Python officially provides a detailed guideline in conventions, but there are
other common practices. Our course may partially follow.

• Indentation:
– Each block section is recommended to be indented with 4-spaces.
• In case of having long code lines, may use 2-spaces for convenience
– Should NOT use tabs (may be displayed differently in different systems)

• Naming:
– Variable / field name reflects its value represents: “what it is”, e.g. radius
– Function / method name reflects its operation and action: “what it does”,
and may start with a verb, e.g. area()
– Class name reflects its value represents: “what it represents”, e.g. Circle

35
Program Example
(Handling Circles – Procedural Approach)
• Suppose we need to build a program for handling circles:
– Given the radius of a circle, we need to calculate the circumference and
area of this specific circle.
– Below is the sample Python code, in a procedural approach, with the main
file to run
# circleV1.py, procedural approach with functions
import math # import the math module

def circumference(radius): # a function


Independent return 2*math.pi*radius
functions for
handling circles def area(radius): # a function to find area
return math.pi*radius*radius
# main_circleV1.py, the main file to start program
from circleV1 import * # import the circleV1

Run on Console def main(): # the main function


radius = float(input("Enter a radius: "))
print(f"Area of circle is {area(radius):.3f}")

main() # start execution 36


Program Example
(Handling Circles – Object-oriented Approach)
• Below is another Python program for handling circles, in OO approach:
# circleV2.py, using OO approach to model a class of Circle
import math # import the math module

class Circle: # define the class of Circle


Define def __init__(self, inRadius=0.0): # constructor
the Class self.radius = inRadius # a field / instance variable
Circle, Circle
with its def circumference(self): # a method
return 2*math.pi*self.radius radius
own
fields and __init__()
methods def area(self): # a method to find area circumference()
return math.pi*self.radius*self.radius area()
# main_circleV2.py , the main file to start program

from circleV2 import Circle # import the class Circle


def main(): # the main function
radius = float(input("Enter a radius: "))
aCircle = Circle(radius) # create/instantiate a new object
print(f"Area of circle is {aCircle.area():.3f}")
37
main() # start execution
Another Program Example – More OO Approach
(Handling Courses and Students)
• The following is the sample Python code in an OO approach to model a
class of courses and their students (name info.): Course
# course.py; sList
__init__(inSLis
class Course: # define the class of Course t)
Define a Class
Course, with def __init__(self, inSList): # constructor getStudent(inde
its own field self.sList = inSList # a field (student list)
x) of course
sList of
student def getStudent(self, index): # method, to get student
(names) and return self.sList[index]
method to get
name of student
in specific index
position def main(): # the main function
studentList = ["AU A", "CHAN C", "HO H", "LI L", "FAN F"]
idsaC = Course(studentList) # create object, to __init__
indexWanted = 2
print(f"Student Index {indexWanted} in our Course is",
idsaC.getStudent(indexWanted)) # method calling

# avoid execution in case of import only


if __name__ == '__main__': main() # start execution
38
Programming Tools Required

• Students are required to demonstrate their understanding of DSA


concepts, and their skills of applying them to programming tasks

• Python is the programming language we use in our course

• Students have to install Python tools properly for Python programming

• References: Python Official Website: https://www.python.org/


– Current stable version: 3.10.*
– Download: https://www.python.org/downloads/
– Current Documents: https://docs.python.org/3/
– Windows Versions: https://www.python.org/downloads/windows/

39
Programming Approaches

• Apart from basic procedural programming approach, we also apply very


basic Object-Oriented approach (with Python language) in our course

• We are using Python list mainly for holding a sequence data like a
conventional array.

• We are NOT using those specific methods of Python list already


implemented by Python (unless specified)
– E.g. we are NOT using Python’s list.append(x) or
list.insert(i,x)

• Instead, in our course we are focusing on designing and implementing


our own, say creating our own classes of List, Stack and Queue with
our own methods / operations

• As such, Python’s list in our course is most used as a fixed-size


structure to hold data, similar to a conventional array.

40
* Some images and information in this material are sourced from the Internet.
* This set of slides is for teaching purpose only.

• Baka, B. (2017) “Python Data Structures and Algorithms”, Packt.


• Bentley, J. (1999). “Programming Pearls”, 2nd Edition, Addison-Wesley Professional.
• Cormen, T. H., Leiserson, C. E., Rivest, R. L. and Stein, C. (2009). “Introduction to
Algorithms” , 3rd Edition, the MIT Press.
• Goodrich, M. T., Tamassia, R. and Goldwasser M. H. (2013). “Data Structures and
Algorithms in Python”, John Wiley & Sons, Inc.
• Knuth D. E. (2011). “The Art of Computer Programming” , Vol. 1-4A, Addison-Wesley
Professional.
• Necaise, R. D. (2011). “Data Structures and Algorithms using Python”, John Wiley &
Sons, Inc.
• https://opendatastructures.org/
• https://www.python.org/doc/

41
Questions

• Which of the following focuses on finding ways to achieve a task with a


finite step-by-step list of well-defined instructions?
A. Algorithm
B. Data Structure
C. Abstract Data Type
D. None of the other answers

• Which of the following is required for defining a class in Python?


A. Keyword class
B. The colon symbol :
C. A valid class name
D. All of the other answers

42

You might also like