0% found this document useful (0 votes)
17 views

CIS Project

Uploaded by

Ph G Nguyen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

CIS Project

Uploaded by

Ph G Nguyen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

The Basics of Programming and Software

Faculty of Mathematics, Informatics and Mechanics


University of Science, VNU

Proponents:
Pham Gia Nguyen 22001626 Supervisor:
Bui Huu Phuoc Do Thanh Ha
Vu Quoc Long

Date: June 3, 2024 Word Count: <####>


Abstract
This report provides a comprehensive overview of the fundamentals of
programming and software development. This first introduces people to
programming languages. It then introduces the concepts, which include
the major concepts, principles, and methods that form the foundation
of the field. The report begins with an introduction to programming
languages, including high-level and low-level languages, as well as the
difference between compiled and interpreted languages. It explores ba-
sic programming constructs such as variables, data types, control struc-
tures, and functions. Also provides readers with knowledge about Alan
Turing as well as the Turing machine and some software-related knowl-
edge.
Note: The report cover design above is only for reference purpose.
Your team may opt for a different report cover if desired.

2
Contents

1 The process of loading programs into the computer and


classical data storage mediums 6
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 Classical Storage Mediums . . . . . . . . . . . . . . . . 6
1.3 The Program Loading Process . . . . . . . . . . . . . . 7
1.4 Prospects and Development Directions . . . . . . . . . . 7
1.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . 7

2 History and Evolution of Programming Languages 8


2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 From Machine Language to Assembly Language . . . . . 8
2.3 Emergence of High-Level Programming Languages . . . 9
2.4 Rise of High-Level Programming Languages . . . . . . . 9
2.5 Influence and Legacy . . . . . . . . . . . . . . . . . . . 10
2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Fundamental Concepts of Programming 12


3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Programming Statements . . . . . . . . . . . . . . . . . 12
3.3 Control Flow Statements . . . . . . . . . . . . . . . . . 13
3.3.1 Loops: While and For . . . . . . . . . . . . . . . 13
3.3.2 Else If . . . . . . . . . . . . . . . . . . . . . . . 14
3.4 Functions: Modular Abstractions . . . . . . . . . . . . . 15
3.5 Case Study . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . 16

4 Introduction to Algorithms and Their Importance 17


4.1 Types of Algorithms . . . . . . . . . . . . . . . . . . . . 17
4.2 Sorting Algorithms . . . . . . . . . . . . . . . . . . . . 18
4.3 Searching Algorithms . . . . . . . . . . . . . . . . . . . 20

3
4.4 Graph Search Algorithms: Dijkstra’s Algorithm . . . . . 21
4.5 Time Complexity . . . . . . . . . . . . . . . . . . . . . 22
4.6 Real-World Applications . . . . . . . . . . . . . . . . . 24
4.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . 25

5 Alan Turing 26
5.1 Introduction to Alan Turing . . . . . . . . . . . . . . . 26
5.2 Formulating Solutions . . . . . . . . . . . . . . . . . . . 26
5.3 Understanding Turing Machines . . . . . . . . . . . . . 26
5.4 Significance of Turing Machines . . . . . . . . . . . . . 27
5.5 Turing’s Contributions During World War II . . . . . . 27
5.6 Post-War Contributions . . . . . . . . . . . . . . . . . . 27
5.7 Legacy and Impact . . . . . . . . . . . . . . . . . . . . 28

6 Software Engineering 29
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2 Object-Oriented Programming (OOP) . . . . . . . . . . 29
6.2.1 What is OOP? . . . . . . . . . . . . . . . . . . . 29
6.2.2 Benefits of OOP . . . . . . . . . . . . . . . . . . 29
6.2.3 Class & Instances . . . . . . . . . . . . . . . . . 30
6.2.4 Four properties of OOP . . . . . . . . . . . . . . 30
6.2.5 API . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.3 IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.3.1 What is IDE ? . . . . . . . . . . . . . . . . . . . 32
6.3.2 Application of IDE . . . . . . . . . . . . . . . . 32
6.4 Writing document . . . . . . . . . . . . . . . . . . . . . 33
6.5 Source control . . . . . . . . . . . . . . . . . . . . . . . 33
6.6 QA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

7 References 35

4
List of Figures

3.1 While loop in python . . . . . . . . . . . . . . . . . . . 13


3.2 For loop in python . . . . . . . . . . . . . . . . . . . . . 14
4.1 Dijkstra’s Algorithm . . . . . . . . . . . . . . . . . . . . 22
4.2 AI Neutron networks . . . . . . . . . . . . . . . . . . . 25
4.3 Data Science and Analytics . . . . . . . . . . . . . . . . 25
6.1 A Class . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.2 Access Modifier . . . . . . . . . . . . . . . . . . . . . . 32

5
Chapter 1

The process of loading programs into


the computer and classical data
storage mediums

1.1 Introduction
The process of loading programs into the computer and classical data
storage mediums is an important part of the IT industry. This helps con-
vert data from the hardware, software, or computer memory to manage
programs. This process requires coordination between hardware and
software to be successful.

1.2 Classical Storage Mediums


• Punch Cards: Used widely from the 1800s to the 20th century,
punch cards are made of paper or plastic material and are small in
size with holes punched or cut out in a specific pattern. Each punch
card contains specific data. The holes represent data bits, and each
is placed specifically to represent certain information. Punch cards
couldn’t store much data but played a vital role in organizing and
accessing it.

• Programming methods before 1980: Before 1980, programming meth-


ods had advanced significantly, especially how code was entered into
computers. Control panels with buttons and switches were created
to input binary codes, offering a new approach to computer pro-
gramming.

6
1.3 The Program Loading Process
• Procedures: For a program to run, it needs to be loaded into a
computer’s memory through punch cards once used to transfer data
from outside the machine into it.
• Challenges in the Loading Process: Using classical data storage
mediums like punch cards presented many challenges and limita-
tions, especially during program loading into computers:
– Time-consuming and labor-intensive: Entering machine code
through punch cards required a significant amount of time and
effort.
– Prone to errors and hard to fix: Manually adjusting the holes
on punch cards could easily cause errors.
– Limited program management: Punch cards are limited in the
number of holes available per card, restricting the size of the
program that can be stored and loaded.
– Susceptibility to damage or loss: Punch cards could easily be
damaged or lost due to their physical weakness, making their
storage and preservation less efficient than modern mediums.

1.4 Prospects and Development Directions


As technology evolves, we hope for newer and more convenient data
storage mediums for easier and more effective program uploading in the
future.

1.5 Conclusion
By studying the process of program loading and classical data storage
mediums, we have gained an overview of how computers work and how
they execute programming tasks. This not only helps us understand the
program loading process better but also opens up new prospects in the
field of computer science.

7
Chapter 2

History and Evolution of


Programming Languages

2.1 Introduction
Until now, programming languages have been powerful tools for build-
ing software applications and are an essential part of today’s technolog-
ical revolution. From controlling simple devices to developing complex
features on websites, programming languages have played a crucial role.
By delving into the history and evolution of programming languages,
we gain a comprehensive understanding of how humans have interacted
with these languages and how programming languages have evolved over
time.

2.2 From Machine Language to Assembly Language


• Machine Language:
– Machine language is a programming language executed directly
by a computer’s processor. It is the most basic language that a
computer can understand, represented by only two digits: 0 and
1.
– While machine language is understandable and executable by
computers, programming in it is complicated due to the lengthy
binary representation of each command.
• Assembly Language:
– Assembly language is closely related to machine language but
uses words (or mnemonics) instead of binary code to represent

8
instructions.
– Although it is easier to understand than machine language, as-
sembly language still requires knowledge of computer architec-
ture and processor operations. Writing programs in this lan-
guage can be challenging and time-consuming compared to high-
level programming languages.

2.3 Emergence of High-Level Programming Languages


During the use of assembly language, Grace Hopper and other devel-
opers recognized many weaknesses in programming with assembly lan-
guage. While using assembly language provides maximum control over
computer operations, it also faces many challenges such as maintenance,
scalability, and resource consumption.
To address these issues, Grace Hopper and other developers researched
and created high-level programming languages to address these weak-
nesses. These high-level languages apply compilers - software that trans-
lates source code into machine code automatically.

2.4 Rise of High-Level Programming Languages


• FORTRAN: Released in 1957, FORTRAN was one of the first
widely used high-level programming languages in the computer field.
It allowed programmers to write shorter and more understandable
code, which was then compiled into machine code by the FORTRAN
compiler.
• COBOL: COBOL emerged as a popular business-oriented language
in 1959, supporting compatibility across multiple computer plat-
forms. The "write once, run anywhere" principle of COBOL helped
reduce complexity in software development.
• C: Developed in the late 1960s, C became one of the most pop-
ular and influential programming languages in history. With high
performance and close access to hardware, C became the ideal pro-
gramming language for developing computer systems and system
software.
• Pascal: Introduced in the 1970s, Pascal was developed for edu-
cational purposes. This language helped learners understand basic

9
programming concepts such as data types, control structures, and
procedures.

• C++: Created in the 1980s and inheriting many features from C,


C++ opened up a new realm with the concept of object-oriented
programming, allowing structured software development and effi-
cient source code reuse.

• JAVA: Introduced in 1995, Java quickly became one of the most


popular programming languages in the world. With the ability to
run on various platforms and high security, Java is widely used
in web, mobile, and desktop application development.source code
reuse.

• PYTHON:Born in the late 1980s but gaining popularity in the


early 21st century, Python is widely used in various fields such
as web development, data science, artificial intelligence, and many
other applications, thanks to its simple and readable syntax.

And there are many other languages that have been created and devel-
oped to this day.

2.5 Influence and Legacy


• Programming languages have made the computer field more acces-
sible to everyone, enabling programmers and experts to integrate
programming applications into their professions to enhance their
work.

• The explicit abstraction of high-level programming languages has


reduced complexity and allowed for faster development of applica-
tion software than classical languages.

• The evolution of programming languages continues over decades,


with new languages constantly being developed to meet emerging
needs and technologies. Each new language aims to create new
abstractions and improvements to enhance the power and flexibility
of programming.

10
2.6 Conclusion
From the birth of machine language to the development of high-
level programming languages, the history of programming is a story of
progress and flexibility. Programming languages have opened the door
for everyone to participate in this field and create amazing applications
and technologies that were previously unimaginable.

11
Chapter 3

Fundamental Concepts of
Programming

3.1 Introduction
In the realm of computer science, programming languages serve as
essential tools for abstracting away intricate hardware details, enabling
programmers to focus on solving problems through computation. This
report delves into the foundational elements that underpin all program-
ming languages, examining statements, control flow, and the pivotal role
of functions.

3.2 Programming Statements


In programming languages, each statement typically represents a spe-
cific action, much like how a complete sentence in spoken language ex-
presses a complete idea.

For example, when we write the statement "A equals 5" in a pro-
gramming language, we are saying that variable A now has a value of 5.
This is similar to saying "I am eating rice" in spoken language, which
describes a specific action taking place.

Every program, like a cooking recipe, consists of a series of statements


arranged purposefully to perform a series of actions from start to finish.
The statements in the program are executed in the order they are listed,
similar to how you follow a cooking recipe step by step.

12
3.3 Control Flow Statements
To navigate beyond linear execution, control flow statements like If-
Else and Loops steer program flow based on conditions. If-Statements,
resembling forks in the road, dictate paths based on truth values, while
loops iteratively execute blocks of code until conditions change.
3.3.1 Loops: While and For

Loops are pivotal for repetitive tasks. A while loop continues iterat-
ing while a condition holds true, dynamically adjusting program behav-
ior. Conversely, for loops offer predetermined iteration counts, providing
controlled repetition within a specified range.

While Loop: The while loop repeats a set of statements as long


as the condition is true. This means the loop will continue until the
condition becomes false. The statements inside the loop must modify
the condition to avoid an infinite loop.
Example pesudo code:
Algorithm 1 Print numbers from 1 to 5 using a while loop
1: Set i to 1
2: while i ≤ 5 do
3: print(i)
4: i++
5: end while

Explanation:
[label=–]Variable i is initially set to 1. The while loop will continue
to run as long as i is less than or equal to 5. Each iteration, the
number i is printed, and i is incremented by 1 (i ++). When i
reaches the value of 6, the condition i <= 5 becomes false, and the
loop ends.

Figure 3.1: While loop in python

For Loop: The for loop is used to iterate over a specific range of

13
values, such as a sequence of numbers or a list of elements. The for loop
allows us to easily iterate over each element in the sequence.
Example :
Algorithm 2 Print numbers from 0 to 4 using a loop
•1: for i = 0 to 4 do
2: Print i
3: end for

Explanation:
[label=–]The for loop starts by initializing the variable i to 1. The
loop condition is that i is less than or equal to 5. After each iteration,
the variable i is incremented by 1 (i++). Each iteration, the value
of i is printed by console.log(i).

Figure 3.2: For loop in python

3.3.2 Else If

In programming languages, the "else if" structure is often used to


check multiple conditions sequentially. This structure is typically used
after an "if" statement and before or after an "else" statement.
For example, consider a simple program to determine the state of
water based on the input value:
Algorithm 3 Determining state of water based on temperature
•1:Let temperature be the current temperature
2: if temperature < 0 then
3: Output "Water is frozen"
4: else if 0 ≤ temperature < 100 then
5: Output "Water is liquid"
6: else
7: Output "Water is boiling"
8: end if

If the temperature is less than 0, the program will print "Water is


frozen". If the temperature is not less than 0 but less than 100, the
program will print "Water is liquid". Otherwise, if the temperature is
greater than or equal to 100, the program will print "Water is boiling".
The "else if" structure allows us to check multiple conditions sequentially

14
without the need for nested "if" statements. This helps make the code
more readable and understandable.

3.4 Functions: Modular Abstractions


In programming, functions are reusable blocks of code that promote
modularization and abstraction. By naming and invoking functions,
programmers break down complexity, enabling clearer and more effi-
cient program design.

When programmers write a program, they often encounter tasks that


are repeated multiple times within the program or across different pro-
grams. Instead of rewriting these code snippets each time they’re needed,
they can encapsulate them within functions. When reuse is required,
they simply call those functions.

Functions can also accept parameters, which are the data they will
process. This allows functions to be more flexible and perform different
tasks based on the values passed in.

Furthermore, functions often return results after completing their


tasks. This facilitates the creation of reusable and scalable functions, as
the results can be used in multiple parts of the program or in different
programs.

3.5 Case Study


Case Study: Calculator Application

A simple calculator application can be used to illustrate fundamental


programming concepts such as variables, operators, and conditionals.
For example, to perform a basic operation like adding two numbers, we
need to use variables to store the values, operators to carry out the com-
putation, and conditionals to handle special cases such as division by
zero.

Case Study: Online Shopping Cart

15
An online shopping cart can demonstrate concepts like functions, ar-
rays, and loops. For instance, each item in the cart can be represented
by a data structure, and an array can be used to store the items in the
cart. Functions can be employed to add, remove, or update items in the
cart, and loops can be used to iterate through the items to calculate the
total value or perform other operations.

Case Study: Weather Forecast Application

A weather forecast application can exemplify concepts such as APIs,


error handling, and concurrency. For instance, to retrieve weather data
from an external service, we can utilize an API. While working with
external data, proper error handling is crucial, such as handling cases
where the connection fails or corrupted data is received. Concurrency
can be used to update weather data concurrently without affecting the
performance of the application. code latex

3.6 Conclusion
In conclusion, programming languages offer a structured framework
comprising statements, control flow mechanisms, and modular abstrac-
tions facilitated by functions. This report emphasizes the significance of
these foundational concepts, paving the way for scalable, comprehensible
software development practices in modern programming.

16
Chapter 4

Introduction to Algorithms and


Their Importance

Algorithms are precise sequences of steps designed to solve specific


problems or perform computations. In the field of computer science,
algorithms play a crucial role in building and developing computer ap-
plications and systems. They provide specific approaches to solving
various problems, from sorting data to searching for information and
analyzing complex data.
Algorithms are essential for solving real-world problems across various
domains. For instance, in data science, algorithms are used to analyze
data and extract valuable information from large datasets. In artificial
intelligence, algorithms are employed to build intelligent systems and
automate processes. In computer networking, algorithms play a vital
role in routing data and managing network resources.

4.1 Types of Algorithms


In computer science, there are several common types of algorithms,
each with its own purpose and applications:

• Sorting: Sorting algorithms are used to arrange elements in a specific


order, such as ascending or descending order.

• Searching: Searching algorithms are used to find a specific element


within a list or data structure.

• Graph: Graph algorithms are used to process graph data struc-


tures, including finding shortest paths, checking connectivity, and
detecting cycles.

17
• Time Complexity: Algorithms are classified based on their time
complexity, ranging from simple algorithms (O(1)) to complex al-
gorithms (O(nlogn) or O(n2 )).

4.2 Sorting Algorithms


Sorting algorithms are essential algorithms used to arrange elements
within a dataset into a specific order, typically ascending or descending,
based on a comparison criterion. Data sorting is a crucial problem in
computer science and finds wide-ranging applications in various fields,
including databases, financial markets, and image processing, to name
a few examples.

There exist several different sorting algorithms, each suited to partic-


ular types of data or specific contexts. Here are some common sorting
algorithms:

Bubble Sort: Bubble sort iterates through a list and compares ad-
jacent elements, swapping them if they are in the wrong order.
Insertion Sort: Insertion sort considers one element from the list at
a time and inserts it into the correct position within the already sorted
part of the list.
Selection Sort: Selection sort finds the smallest element from the
list and moves it to the beginning of the sorted list.
Merge Sort: Merge sort sorts a list by dividing it into smaller parts,
sorting each part, and then merging them back together in order.
Quick Sort: Quick sort sorts a list by partitioning it into smaller
parts based on a chosen element called the "pivot", then sorting the
smaller and larger parts recursively. ....
Each algorithm has its own advantages and disadvantages. For in-
stance, bubble sort has lower efficiency compared to other algorithms,
while quick sort is often fast and efficient but can suffer from worst-case
time complexity of O(N 2 ) if a poor pivot choice is made. Choosing the
appropriate sorting algorithm depends on factors such as the size of the
input data, the nature of the data, and other considerations like memory
space and performance requirements.
Example:
Selection Sort Sorting algorithms arrange elements in a specific or-

18
der. Selection Sort, a basic sorting algorithm, repeatedly identifies the
smallest element from an unsorted portion of an array and moves it to
its correct position. Despite its simplicity, Selection Sort exhibits a com-
putational complexity of O(N 2 ), making it inefficient for large datasets
due to its quadratic growth rate.

Algorithm 4 Selection Sort Algorithm


1: function SelectionSort(arr)
2: n ← length of arr
3: for i ← 0 to n − 1 do
4: min_index ← i
5: for j ← i + 1 to n do
6: if arr[j] < arr[min_index] then
7: min_index ← j
8: end if
9: end for
10: Swap arr[i] and arr[min_index]
11: end for
12: end function

Merge Sort Contrasting Selection Sort, Merge Sort demonstrates


efficiency through a divide-and-conquer approach. It recursively divides
the array into smaller subarrays, sorts them individually, and merges
them back together in sorted order. With a time complexity of O(N log
N), Merge Sort outperforms Selection Sort for large datasets, reflecting
its scalability and effectiveness.

19
Algorithm 5 Merge Sort Algorithm
1: function MergeSort(arr)
2: if length of arr ≤ 1 then
3: return arr
4: end if
5: mid ← length of arr//2
6: lef t ← MergeSort(arr[: mid])
7: right ← MergeSort(arr[mid :])
8: return Merge(lef t, right)
9: end function
10: function Merge(lef t, right)
11: result ← []
12: i←j←0
13: while i < length of lef t and j < length of right do
14: if lef t[i] < right[j] then
15: Append lef t[i] to result
16: i←i+1
17: else
18: Append right[j] to result
19: j ←j+1
20: end if
21: end while
22: Append remaining elements of lef t to result
23: Append remaining elements of right to result
24: return result
25: end function

4.3 Searching Algorithms


Searching algorithms are used to find a specific element within a list
or data structure. These algorithms are essential in various applications
where quick retrieval of information is required.
There are several common searching algorithms, including:

• Linear Search: In linear search, each element of the list is checked


one by one until the desired element is found or the end of the list
is reached.
• Binary Search: Binary search is applicable only on sorted arrays. It
compares the target value to the middle element of the array and
continues narrowing down the search interval until the target value
is found.
• Depth-First Search (DFS): DFS is used to traverse or search tree
or graph data structures. It explores as far as possible along each
branch before backtracking.
• Breadth-First Search (BFS): BFS is another algorithm for traversing

20
or searching tree or graph data structures. It explores all neighbor
nodes at the present depth before moving on to the nodes at the
next depth level ....

Example:
Linear Search:

Algorithm 6 Linear Search


1: procedure LinearSearch(arr, target)
2: for i ← 0 to length(arr) − 1 do
3: if arr[i] = target then
4: return i ▷ Element found
5: end if
6: end for
7: return −1 ▷ Element not found
8: end procedure

Binary Search:

Algorithm 7 Binary Search


1: procedure BinarySearch(arr, target)
2: lef t ← 0
3: right ← length(arr) − 1
4: while lef t ≤ right do
5: mid ← ⌊(lef t + right)/2⌋
6: if arr[mid] = target then
7: return mid ▷ Element found
8: else if arr[mid] < target then
9: lef t ← mid + 1
10: else
11: right ← mid − 1
12: end if
13: end while
14: return −1 ▷ Element not found
15: end procedure

4.4 Graph Search Algorithms: Dijkstra’s Algorithm


Graphs represent networks of interconnected nodes, akin to city maps
with roads and distances. Dijkstra’s algorithm efficiently finds the short-
est path between nodes by maintaining a priority queue of nodes based
on their computed costs. It iteratively explores paths, updating costs
and paths as it progresses towards the target node. Despite its origi-
nal quadratic complexity, optimizations have improved its scalability to
O(N log N) for sparse graphs.

21
Figure 4.1: Dijkstra’s Algorithm

4.5 Time Complexity


Algorithm complexity is a critical factor in software development and
computer science as it directly impacts the performance and efficiency
of applications and systems. Here are some important points regarding
the significance of algorithm complexity:

1. Application Performance: Algorithm complexity affects the run-


time of applications. Algorithms with lower complexity run faster
and provide a better user experience.
2. Scalability: When building large systems or handling big data, al-
gorithm performance becomes crucial. Algorithms with lower com-
plexity are often more scalable to handle larger datasets without
sacrificing performance.
3. Resource Consumption: Algorithm complexity not only affects
runtime but also other resources such as memory. Algorithms with
high complexity may consume more memory and can lead to per-
formance issues or undesired behavior on devices with limited re-
sources.
4. Design Challenges: Algorithm complexity poses a challenge in
software design and development. Choosing and implementing ap-

22
propriate algorithms can impact the architecture of the system and
resource utilization.

5. Performance Optimization: Understanding algorithm complex-


ity helps developers optimize their applications and select the most
suitable algorithms for specific problems. This improves perfor-
mance and enhances user experience.

Example:
Linear Search:
The time complexity of linear search in the worst-case scenario is
O(n), where n is the number of elements in the list or array. In the
best-case scenario, the time complexity is also O(1) if the element to be
found is the first element in the list or array. The basic way to calculate
the complexity of linear search is to count the number of iterations, as
each element in the list or array is checked once.

Binary Search:
The time complexity of binary search is O(log n) in the worst-case
and average-case scenarios, where n is the number of elements in the
list or array. The basic approach to calculate the complexity of binary
search is to count the number of iterations in the process of dividing the
array into halves and searching for the element in each half.

Dijkstra’s Algorithm:
The time complexity of Dijkstra’s algorithm is O((V + E) log V ),
where V is the number of vertices in the graph and E is the number
of edges. The basic approach to calculate the complexity of Dijkstra’s
algorithm is to analyze the steps in finding the shortest path from one
vertex to all other vertices in the graph, including traversing all vertices
and edges in the graph and using a priority queue to select the vertex
with the shortest path.
In summary, algorithm complexity plays a vital role in building high-
performance, scalable systems. Understanding and managing algorithm
complexity is an essential part of software development, leading to better-
designed systems and improved performance.

23
4.6 Real-World Applications
Algorithms are like the unsung heroes of modern technology, quietly
working behind the scenes to make our lives easier and more efficient.
They’re the secret sauce that powers many of the applications and ser-
vices we use every day, from finding the fastest route on Google Maps
to keeping our data secure online.

• Navigation Systems: Ever wonder how Google Maps knows the


best route to your destination? Algorithms! They crunch through
data on traffic patterns, road closures, and your preferences to find
the quickest way for you to get from point A to point B.

• Data Science and Analytics: In fields like finance, healthcare,


and marketing, algorithms analyze massive amounts of data to un-
cover trends, make predictions, and guide decision-making. They’re
like detectives, sifting through data to find valuable insights.

• Machine Learning and AI: You know those personalized recom-


mendations on Netflix or Amazon? Algorithms are at work there
too. They learn from your behavior to suggest movies, products,
and content you’re likely to enjoy, all without needing explicit in-
structions.

• Computer Vision: Algorithms power technologies like facial recog-


nition and object detection, allowing computers to "see" and under-
stand the world around them. From security cameras to self-driving
cars, computer vision is everywhere.

• Natural Language Processing: Ever talk to a chatbot or use


voice commands on your phone? Algorithms are the brains behind
these interactions, parsing language, understanding context, and
generating responses.

• Cybersecurity: Algorithms are crucial for keeping our data safe


online. They encrypt our communications, authenticate users, and
detect and prevent cyber attacks, helping to safeguard our digital
lives.

24
Figure 4.2: AI Neutron networks

Figure 4.3: Data Science and Analytics

Algorithms are like the building blocks of modern technology, enabling


us to solve complex problems, make smarter decisions, and interact with
digital systems in ways we never thought possible. They’re the unsung
heroes that quietly shape our digital world every day.

4.7 Conclusion
In conclusion, algorithms are the cornerstone of computer science, fa-
cilitating efficient problem-solving and computation. By studying and
optimizing algorithms like Selection Sort, Merge Sort, and Dijkstra’s al-
gorithm, computer scientists leverage foundational principles to address
diverse challenges in software development and beyond.
Through this exploration of algorithmic concepts, we recognize their
pivotal role in shaping the modern digital landscape and paving the way
for innovative advancements in technology.

25
Chapter 5

Alan Turing

5.1 Introduction to Alan Turing


• Alan Mathison Turing, born in London in 1912, demonstrated ex-
ceptional aptitude in mathematics and science from an early age.
• In 1935, as a master’s student at King’s College, Cambridge, he
encountered the Entscheidungsproblem, a mathematical challenge
posed by David Hilbert, which sparked his interest in theoretical
computer science.

5.2 Formulating Solutions


• Turing and American mathematician Alonzo Church independently
developed solutions to the Entscheidungsproblem.
• Church introduced Lambda Calculus, while Turing proposed Turing
Machines, a theoretical model of computation.
• Turing Machines offered a simple yet powerful way to understand
computation, demonstrating equivalence with Lambda Calculus but
with greater accessibility.

5.3 Understanding Turing Machines


• Turing Machines consist of an infinite memory tape, a read/write
head, a state variable, and a set of rules governing its actions.
• Rules dictate operations such as reading and writing symbols, chang-
ing states, and moving the head.

26
• A simple example of a Turing Machine is presented to illustrate its
functionality in determining if a string of ones ends with an even
number of ones.

5.4 Significance of Turing Machines


• Turing Machines represent a fundamental concept in computer sci-
ence, demonstrating the theoretical basis for universal computation.

• Despite their simplicity, Turing Machines exemplify the potential


for solving any computational problem given sufficient time and
memory.

The Halting Problem

• Turing applied Turing Machines to the halting problem, which seeks


to determine if a given program will halt or run indefinitely.

• He proved that the halting problem is unsolvable through a clever


logical contradiction, showcasing the limits of computation.

5.5 Turing’s Contributions During World War II


• Turing’s genius was utilized in Britain’s code-breaking efforts during
World War II with German.

• He played a crucial role in decrypting German communications, par-


ticularly those encrypted using the Enigma machine, by designing
the Bombe, a special-purpose electromechanical computer.

5.6 Post-War Contributions


• After the war, Turing contributed to early electronic computing
endeavors, including the Manchester Mark 1 computer.

• He made significant contributions to the field of artificial intelli-


gence, proposing the Turing Test as a measure of machine intelli-
gence.

27
5.7 Legacy and Impact
• Turing’s work laid the foundation for modern computer science and
artificial intelligence.
• His visionary ideas continue to influence research and development
in computing and AI, shaping the trajectory of technological ad-
vancement.

28
Chapter 6

Software Engineering

6.1 Introduction
Sorting algorithms as a gateway to understanding software engineer-
ing. Emphasis on the disparity between the simplicity of sorting algo-
rithms and the complexity of large-scale programs like Microsoft Office,
which contain 40 millions of lines of code. Software Engineering as a
discipline to manage such complexity.

6.2 Object-Oriented Programming (OOP)


6.2.1 What is OOP?

Object Oriented Programming is a coding paradigm that organizes


code around data, aka “objects”, rather than functions and procedures.
OOP simplifies software development by enabling us to model any data
that we need, and work with that data in a logical way.
6.2.2 Benefits of OOP

The object-oriented languages focus on components that the user per-


ceives, with objects as the basic unit. You figure out all the objects by
putting all the data and operations that describe the user’s interaction
with the data.
Some benefits:

• Ease in software design: as you could think in the problem


space rather than the machine’s bits and bytes. You are dealing
with high-level concepts and abstractions. Ease in design leads to
more productive software development.
• Ease in software maintenance: object-oriented software are eas-

29
ier to understand, therefore easier to test, debug, and maintain.
• Reusable software: you don’t need to keep re-inventing the wheels
and re-write the same functions for different situations. The fastest
and safest way of developing a new application is to reuse existing
codes - fully tested and proven codes.
6.2.3 Class & Instances

A class is a definition of objects of the same kind. In other words,


a class is a blueprint, template, or prototype that defines and describes
the static attributes and dynamic behaviors common to all objects of
the same kind.
An instance is a realization of a particular item of a class. In other
words, an instance is an instantiation of a class.
Structure of a class:

Figure 6.1: A Class

A class can be visualized as a three-compartment box, as illustrated:


• Name (or identity): identifies the class.
• Variables (or attribute, state, field): contains the static attributes
of the class.
• Methods (or behaviors, function, operation): contains the dynamic
behaviors of the class.
In other words, a class encapsulates the static attributes (data) and
dynamic behaviors (operations that operate on the data) in a box.
6.2.4 Four properties of OOP
Inheritance:

The classes in the lower hierarchy inherit all the variables (static at-
tributes) and methods (dynamic behaviors) from the higher hierarchies.

30
A class in the lower hierarchy is called a subclass (or derived, child, ex-
tended class). A class in the upper hierarchy is called a superclass (or
base, parent class).
Polymorphism:

Polymorphism is the ability of an object to take on different forms.


So, polymorphism means innumerable forms. Polymorphism, therefore,
is one of the most significant features of Object-Oriented Programming.
Encapsulation:

Encapsulation refers to keeping the data and method inside a class


such users do not access the data directly but via the public methods.
Abstraction:

Abstraction is the concept of object-oriented programming that shows


only essential attributes and hides unnecessary information. Abstraction
is selecting data from a larger pool to show only relevant details of the
object to the user. It helps in reducing programming complexity and
efforts.
6.2.5 API
What is an API ?

API is stand for Application Programming Interface. An application


programming interface (API) is code that enables two software programs
to communicate. An API defines how a developer should request services
from an operating system (OS) or other application, and expose data
within different contexts and across multiple channels.
How do APIs work ?

APIs are made up of two related elements:

• A specification that describes how information is exchanged between


programs in the form of a request for processing and a return of the
necessary data

• A software interface written to that specification and published in


some way for use.

The software that wants to access the features and capabilities of the
API is said to call it, and the software that creates the API is said to
publish it.
Programming languages do it by using Access Modifier.

31
Figure 6.2: Access Modifier

6.3 IDE
6.3.1 What is IDE ?

IDE is stand for Integrated Development Environment. Before com-


piling, code is only text, so you can use notepad. However, IDE inte-
grates many useful tools to write, build, compile and test.
6.3.2 Application of IDE
Code editing automation:

Programming languages have rules for how statements must be struc-


tured. Because an IDE knows these rules, it contains many intelligent
features for automatically writing or editing the source code.
Syntax highlighting:

An IDE can format the written text by automatically making some


words bold or italic, or by using different font colors. These visual cues
make the source code more readable and give instant feedback about
accidental syntax errors.
Intelligent code completion:

Various search terms show up when you start typing words in a search
engine. Similarly, an IDE can make suggestions to complete a code
statement when the developer begins typing.
Refactoring support:

Code refactoring is the process of restructuring the source code to


make it more efficient and readable without changing its core function-
ality. IDEs can auto-refactor to some extent, allowing developers to
improve their code quickly and easily. Other team members understand
readable code faster, which supports collaboration within the team.
Compilation:

An IDE compiles or converts the code into a simplified language that


the operating system can understand. Some programming languages

32
implement just-in-time compiling, in which the IDE converts human-
readable code into machine code from within the application.
Testing:

The IDE allows developers to automate unit tests locally before the
software is integrated with other developers’ code and more complex
integration tests are run.
Debugging:

Debugging is the process of fixing any errors or bugs that testing


reveals. One of the biggest values of an IDE for debugging purposes is
that you can step through the code, line by line, as it runs and inspect
code behavior. IDEs also integrate several debugging tools that highlight
bugs caused by human error in real time, even as the developer is typing.

6.4 Writing document


This can be done in a standalone file called Readme.txt or as a com-
ment in the code.
Benefits of writing document:

• It helps developers review code they haven’t seen in a while.

• It helps new member approach this code.

• Promote reusing code.

6.5 Source control


Version control, also known as source control, is the practice of track-
ing and managing changes to software code. Version control systems
are software tools that help software teams manage changes to source
code over time. As development environments have accelerated, version
control systems help software teams work faster and smarter.
Version control software keeps track of every modification to the code
in a special kind of database. If a mistake is made, developers can turn
back the clock and compare earlier versions of the code to help fix the
mistake while minimizing disruption to all team members.
Main code is in master/main branch, which is always able to compiled
and has minimum bugs.

33
6.6 QA
QA standard for Quality Assurance.
This is where a team tests and attempt to create unforeseen condi-
tions, that might trip it up.
Companies will sometimes release Beta version. This is a version of
software that’s mostly complete, but not fully tested.
Before Beta version, we have Alpha version. It is usually so rough
and buggy, it’s only tested internally.

34
Chapter 7

References

• https://www.geeksforgeeks.org/the-evolution-of-program
ming-languages/
• https://en.wikipedia.org/wiki/History_of_programming_l
anguages
• https://www.geeksforgeeks.org/basics-of-computer-progr
amming-for-beginners/
• https://www.geeksforgeeks.org/software-engineering-int
roduction-to-software-engineering/
• https://m.youtube.com/playlist?list=PL8dPuuaLjXtNlUrzy
H5r6jN9ulIgZBpdo
• https://www.geeksforgeeks.org/learn-data-structures-a
nd-algorithms-dsa-tutorial/
• https://www.freecodecamp.org/news/learn-data-s
• https://en.wikipedia.org/wiki/Alan_Turing

35

You might also like