You are on page 1of 6

Anthony R.

Gozo DCIT 25
BSInfoTech 301- A Ms. Obon

Assignment #1

Data Structure and Algorithms - A data structure is a named location that can be used to
store and organize data. And, an algorithm is a collection of steps to solve a particular problem.
Learning data structures and algorithms allow us to write efficient and optimized computer
programs.
1.1 Philosophy of Data Structures – As we develop more powerful computers, our history so
far has always been to use that additional computing power to tackle more complex problems,
be it in the form of more sophisticated user interfaces, bigger problem sizes, or new problems
previously deemed computationally infeasible. More complex problems demand more
computation, making the need for efficient programs even greater. Unfortunately, as tasks
become more complex, they become less like our everyday experience.
1.1.1 The Need for Data Structures - As applications are becoming more complex and the
amount of data is increasing day by day, which may cause problems with processing speed,
searching data, handling multiple requests etc. Data structure provides a way of organizing,
managing, and storing data efficiently. With the help of data structure, the data items can be
traversed easily. Data structure provides efficiency, reusability and abstraction.
1.1.2 Costs and Benefits - Each data structure has associated costs and benefits. In practice,
it is hardly ever true that one data structure is better than another for use in all situations. If one
data structure or algorithm is superior to another in all respects, the inferior one will usually have
long been forgotten. For nearly every data structure and algorithm presented in this book, you
will see examples of where it is the best choice. Some of the examples might surprise you.
A data structure requires a certain amount of space for each data item it stores, a certain
amount of time to perform a single basic operation, and a certain amount of programming effort.
Each problem has constraints on available space and time. Each solution to a problem makes
use of the basic operations in some relative proportion, and the data structure selection process
must account for this. Only after a careful analysis of your problem’s characteristics can you
determine the best data structure for the task.
1.2 Abstract Data Types and Data Structures - An abstract data type (ADT) is the
specification of a data type within some language, independent of an implementation. The
interface for the ADT is defined in terms of a type and a set of operations on that type. The
behavior of each operation is determined by its inputs and outputs. An ADT does not
specify how the data type is implemented. These implementation details are hidden from the
user of the ADT and protected from outside access, a concept referred to as encapsulation.
A data structure is the implementation for an ADT. In an object-oriented language, an ADT and
its implementation together make up a class. Each operation associated with the ADT is
implemented by a member function or method. The variables that define the space required by
a data item are referred to as data members. An object is an instance of a class, that is,
something that is created and takes up storage during the execution of a computer program.
The term data structure often refers to data stored in a computer’s main memory. The related
term file structure often refers to the organization of data on peripheral storage, such as a disk
drive or CD.
1.3 Design Patterns - In software engineering, a design pattern is a general repeatable solution
to a commonly occurring problem in software design. A design pattern isn't a finished design
that can be transformed directly into code. It is a description or template for how to solve a
problem that can be used in many different situations.
Flyweight - Flyweight pattern is primarily used to reduce the number of objects created and to
decrease memory footprint and increase performance. This type of design pattern comes under
structural pattern as this pattern provides ways to decrease object count thus improving the
object structure of application.
Visitor - In Visitor pattern, we use a visitor class which changes the executing algorithm of an
element class. By this way, execution algorithm of element can vary as and when visitor varies.
This pattern comes under behavior pattern category. As per the pattern, element object has to
accept the visitor object so that visitor object handles the operation on the element object.
1.3.3 Composite - Composite pattern is used where we need to treat a group of objects in
similar way as a single object. Composite pattern composes objects in term of a tree structure to
represent part as well as whole hierarchy. This type of design pattern comes under structural
pattern as this pattern creates a tree structure of group of objects. This pattern creates a class
that contains group of its own objects. This class provides ways to modify its group of same
objects. We are demonstrating use of composite pattern via following example in which we will
show employees hierarchy of an organization.
1.3.4 Strategy - In Strategy pattern, a class behavior or its algorithm can be changed at run
time. This type of design pattern comes under behavior pattern. In Strategy pattern, we create
objects which represent various strategies and a context object whose behavior varies as per its
strategy object. The strategy object changes the executing algorithm of the context object.
1.4 - Problems, Algorithms, and Programs 
A problem is a function or a mapping of inputs to outputs. An algorithm is a recipe for solving a
problem whose steps are concrete and unambiguous. Algorithms must be correct, of finite
length, and must terminate for all inputs. A program is an instantiation of an algorithm in a
programming language. The following slideshow should help you to visualize the differences.
Problem - A problem is a task to be performed. It is best thought of in terms of inputs and
matching outputs. A problem definition should not include any constraints on how the problem is
to be solved. The solution method should be developed only after the problem is precisely
defined and thoroughly understood. However, a problem definition should include constraints on
the resources that may be consumed by any acceptable solution. For any problem to be solved
by a computer, there are always such constraints, whether stated or implied. 
Algorithms - An algorithm is a method or a process followed to solve a problem. If the problem
is viewed as a function, then an algorithm is an implementation for the function that transforms
an input to the corresponding output. A problem can be solved by many different algorithms. A
given algorithm solves only one problem (i.e., computes a particular function). OpenDSA
modules cover many problems, and for several of these problems we will see more than one
algorithm. For the important problem of sorting there are over a dozen commonly known
algorithms!
Program - We often think of a computer program as an instance, or concrete representation, of
an algorithm in some programming language. Algorithms are usually presented in terms of
programs, or parts of programs. Naturally, there are many programs that are instances of the
same algorithm, because any modern computer programming language can be used to
implement the same collection of algorithms.
Python

1. Define Python – Python is a computer programming language often used to build


websites and software, automate tasks, and conduct data analysis. Python is free and
simple to learn. Its primary features are that it
is highlevel, dynamically typed and interpreted. This makes debugging of errors easy
and encourages the rapid development of application prototypes, marking itself as the
language to code with. Python was developed in 1989 by Guido Van Rossum and
emphasizes on the DRY (Don’t Repeat Yourself) principle and readability.

2. History of Evolution of phyton – Working at CWI (Centrum Wiskunde & Informatica)


at that time, van Rossum discussed the future of Python with his manager. They
eventually agreed to publish it open-source. It may seem obvious today, but the
business model for developing programming languages was still unclear in 1991.

02.1991 Python 0.9.0 -February 1991 was a historic date. Guido van Rossum published
the source code of the Python interpreter to alt.source, a Usenet group for open-source
code. Thus began the dynamic story of Python, and open-sourcing helped Python
succeed.

The first version, Python 0.9.0, was inspired by the ABC language van Rossum was
implementing at CWI at that time. Its main goal was to take the best from ABC and fix
the rest. This first Python release had the following important features:

 Classes with inheritance exception handling.


 Functions.
 Modules.
 Core data types like list, dict, and str.

01.1994 Python 1.0 - Another milestone in the history of Python came with the release
of its second version in January 1994. A separate Usenet group was created for this
purpose.

Additional functionalities were implemented with this version:

 Functional programming tools (lambda, map, filter, and reduce).


 Support for complex numbers.
 Functions with keyword arguments.
10.2000 Python 2.0 - With this version, Python started to build toward its future form as
a reliable language with a comfortable development experience. Important features
introduced in this version included the following:

 List comprehension.
 Cycle-detecting garbage collector.
 Support for Unicode.
 Unification of data types and classes.

12.2008. Python 3.0 - The work on this version began back in 2000. Developers wanted
to streamline the language and eliminate unnecessary language constructs and
functions that had accumulated during almost 20 years of Python's existence.

Python 3.0 was backward-incompatible and brought some unexpected complications. It


turned out Python was being widely used and often depended on other Python libraries.

Even with all the difficulties, the improvements in this version were important. The
features implemented in Python 3.0 included the following:

 The print keyword was changed to the print() function.


 The raw_input() function was deprecated.
 It unified the str and unicode types.
 It included utilities for automatic conversion of Python 2.x code.

The migration from Python 2 was finally completed with its retirement in 2020.

10.2020 Python 3.9 - The rapid growth of Python's popularity began in 2010. Soon,
Python was competing with the most popular languages like Java and JavaScript.

Other features have been implemented in this current version of Python:

 Dictionary merge and mpdate operators.
 New removeprefix() and removesuffix() string methods.
 Built-in generic types.

Python's popularity grew with the rise of fields such as machine learning and Big Data.
But it owes much of its position to the number of developers using Python in their
everyday work.

3. Advantage in learning Phyton


 Python can be used to develop prototypes, and quickly because it is so easy to work
with and read.
 Most automation, data mining, and big data platforms rely on Python. This is
because it is the ideal language to work with for general purpose tasks.
 Python allows for a more productive coding environment than massive languages
like C# and Java. Experienced coders tend to stay more organized and productive
when working with Python, as well.
 Python is easy to read, even if you’re not a skilled programmer. Anyone can begin
working with the language, all it takes is a bit of patience and a lot of practice. Plus,
this makes it an ideal candidate for use among multi-programmer and large
development teams.
 Python powers Django, a complete and open source web application framework.
Frameworks – like Ruby on Rails – can be used to simplify the development process.
4. Applications of Python – Python supports cross-platform operating systems which
makes building applications with it all the more convenient. Some of the globally known
applications such as YouTube, BitTorrent, DropBox, etc. use Python to achieve their
functionality.

5. Careers in Python

Python Developer - Becoming a Python developer is the most direct job out there
for someone who knows the Python programming language.

A Python developer can be expected to:


 Build websites
 Optimize data algorithms
 Solve data analytics problems
 Implementing security and data protection
 Writing reusable, testable and efficient code
Product Manager - Product managers are responsible for researching new user
features, find gaps in the market, and make an argument for why certain products
should be built. Data plays a huge role in their work, so many companies are now
seeking product managers who know Python.

Data Analyst - Does the idea of finding meaning in large amounts of information
appeal to you? Many companies are looking for someone who can sift through large
sets of data — and a popular way to accomplish that is using Python libraries such
as SciPy and Pandas.

Educator - Becoming a computer science instructor may be the first thing that
comes to mind, but it’s not the only teaching role available to those who know
Python. Nearly every university and coding bootcamp, as well as online coding
tutoring platforms like CodeMentor, are in need of people to teach Python!

Financial Advisors - In 2018, Citigroup began training their bank analysts to learn
Python. The hope is that having the chops to program computer code will cut costs,
and increase the bank’s revenue.

Data Journalist - Data journalism is a specialty within journalism that uses data to
tell stories. Journalist who know Python are in demand because of their ability to
rapidly sort through information. If you’re a solid writer to boot, this might be just the
role for you.
6. Features of Python
 Free and Open Source - Python language is freely available at the official website
and you can download it from the given download link below click on the Download
Python keyword.
 Easy to code - Python is a high-level programming language. Python is very easy to
learn the language as compared to other languages like C, C#, Javascript, Java, etc.
 Easy to Read - As you will see, learning Python is quite simple.
 Object-Oriented Language - One of the key features of Python is Object-Oriented
programming. Python supports object-oriented language and concepts of classes,
object encapsulation, etc. 
 GUI Programming Support - Graphical User interfaces can be made using a module
such as PyQt5, PyQt4, wxPython, or Tk in python.
 High-Level Language - Python is a high-level language. When we write programs in
Python, we do not need to remember the system architecture, nor do we need to
manage the memory.
 Extensible feature - Python is an Extensible language. We can write some Python
code into C or C++ language and also we can compile that code in C/C++ language.
 Easy to Debug - Excellent information for mistake tracing. You will be able to quickly
identify and correct the majority of your program’s issues once you understand how
to interpret Python’s error traces.
 Python is a Portable language - Python language is also a portable language. For
example, if we have Python code for windows and if we want to run this code on other
platforms such as Linux, Unix, and Mac then we do not need to change it, we can run
this code on any platform.
 Python is an Integrated language - Python is also an Integrated language because
we can easily integrate Python with other languages like C, C++, etc. 
 Interpreted Language - Python is an Interpreted Language because Python code is
executed line by line at a time.  
 Large Standard Library - Python has a large standard library that provides a rich set
of modules and functions so you do not have to write your own code for every single
thing.
 Dynamically Typed Language - Python is a dynamically-typed language. That
means the type (for example- int, double, long, etc.)
 Frontend and backend development - With a new project py script, you can run and
write Python codes in HTML with the help of some simple tags <py-script>, <py-env>,
etc.
 Allocating Memory Dynamically - In Python, the variable data type does not need to
be specified. The memory is automatically allocated to a variable at runtime when it is
given a value.

You might also like