The document contains the syllabus for the course "Problem Solving and Python Programming" taught at Knowledge Institute of Technology. It includes 4 illustrative problems covered in the syllabus: finding the minimum in a list, inserting a card in a sorted list, guessing a number within a range, and solving the Tower of Hanoi puzzle. Algorithms and pseudocode are provided for each problem to demonstrate the problem-solving approach.
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion should be inserted
while some elements unsorted:
Using linear search, find the location in the sorted portion where the 1st element of the unsorted portion
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Immunizing Image Classifiers Against Localized Adversary Attacks
UNIT I_PSPP - Illustrative Problems (1).pptx
1. Knowledge Institute of Technology, Salem-637504
(Affiliated to Anna University, Chennai)
(Accredited by NAAC)
Department of Computer Science and Engineering
(Accredited by NBA)
Course
Code
GE8151 Course Name
PROBLEM SOLVING AND
PYTHON PROGRAMMING
Year I SEM I CLASS CSE
Name of
the Faculty
Mrs.R.Sathya Priya, Assistant Professor Dept. CSE
PSPP U-I
2. UNIT-I ALGORITHMIC PROBLEM
SOLVING Algorithms, Building Blocks of
algorithms (statements, state, control flow,
functions), Notation (pseudo code, flow chart,
programming language), Algorithmic problem
solving, Simple strategies for developing
algorithms (iteration, recursion).
Illustrative problems: find minimum in a list,
insert a card in a list of sorted cards, Guess an
SYLLABUS
2
3. 3
Illustrative problems:
Find minimum in a list.
Insert a card in a list of sorted cards.
Guess an integer number in a range.
Towers of Hanoi.
5. List
5
List is a collection of elements stored under a
common name.
List is commonly represented by using [ ].
Example:
b[ ] = {10, 20, 30, 40, 50}
b [0] b [1] b [2] b[3] b[4]
10 20 30 40 50
6. Finding Minimum in a list
6
Given a list of numbers from which you are
supposed to find the minimum value.
An algorithm is required for entering the numbers
in the list and then calculate the minimum value.
How it works?
Take the first number in the list and call it
minimum.
Compare the minimum’s value with all other
values in the list one by one.
The moment you find a smaller element than the
7. 7
Example
Initial List 8 6 9 10 5 7 3 21
Let Min = 8, Compare MIN with every element in the list one by one.
8 6 9 10 5 7 3 21
Step 1: 6<Min, So set Min=6
8 6 9 10 5 7 3 21
Step 2: 9 > Min , So no change
8 6 9 10 5 7 3 21
Step 3: 10 > Min , So no change
8 6 9 10 5 7 3 21
Step 4: 5 < Min, So Set Min =5
8 6 9 10 5 7 3 21
Step 5: 7 > Min, So No Change.
8 6 9 10 5 7 3 21
Step 6: 3 < Min, So Set Min=3
8 6 9 10 5 7 3 21
Step 7: 21 > Min , So No change
So the minimum value in the given list is 3.
8. 8
Algorithm:
Step 1: Start the program.
Step 2: Read the number of elements in list n.
Step 3: Initialize i=0 as the starting index
Step Repeat steps 4.1 and 4.2 until the while
condition is true (i<n ) , otherwise continue with
step5 .
Step 4.1: Read the element a[i]
Step 4.2: i=i+1
Step 5: initialize k=1, Min=a[0]
Step 6: Repeat step 6.1 and 6.2 until the while
condition is true (k<n), otherwise continue with
step7.
Step 6.1: If a[k]<Min then set Min=a[k]
Step 6.2: k=k+1
9. 9
Pseudo code:
READ N
INITIALIZE i=0,
WHILE i<n
READ a[i]
SET i=i+1
ENDWHILE
INITIALIZE Min=a[0], k=1
WHILE k<n
IF a[k] < Min THEN
Min=a[k]
k=k+1
ENDWHILE
PRINT Min
12. Inserting a Card into a list of sorted
Cards
12
Inserting a card in a list of sorted cards is same as
inserting an element into a sorted list of numbers.
For this, start from the end of the list and compare
the new element with the elements of the list to
find a suitable position at which the new element
has to be inserted.
While comparing, also shift the elements one step
ahead to create a vacancy for the new element.
13. 13
Example : Insert the element 23 into the given sorted list
Position 0 1 2 3 4 5 6
Original list 10 15 20 25 30 35
Step 1: 23>35 ? No so move 35 to position 6
10 15 20 25 30 35
Step 2: 23>30 ? No so move 30 to position 5
10 15 20 25 30 35
Step 3: 23>25 ? No so move 25 to position 4
10 15 20 25 30 35
Step 4: 23>20 ? Yes insert 23 at position 3
10 15 20 23 25 30 35
14. 14
Algorithm:
Step 1: Start the program.
Step 2: Read the number of elements in list n.
Step 3: Initialize i=0
Step 4: Repeat steps 4.1 and 4.2 until the while condition is true
(i<n ) , otherwise continue with step5 .
Step 4.1: Read the element a[i] –in sorted order
Step 4.2: i=i+1
Step 5: Read the element to be inserted X
Step 6: Set j=n-1
Step 7: Repeat steps 7.1 and 7.2 until the while condition is true
( (j>=0) && (X<a[j])) otherwise continue with step8 .
Step 7.1: a[j+1]=a[j]
Step 7.2: Set j=j-1
Step 8: a[j+1] = X
Step 9: Stop the Program.
15. 15
Pseudo code:
READ n
SET i=0
WHILE i<n
READ a[i]
i=i+1
ENDWHILE
READ X
SET j=n-1
WHILE j>=0 && a[j]>X
a[j+1]=a[j]
j=j-1
ENDWHILE
a[j+1]=X
18. Guess an integer number in a
range
18
It is a game.
The user selects a range.
Let’s say User selected a range, i.e., from A to B,
where A and B belong to Integer.
Some random integer will be selected by the system and
the user has to guess that integer in the minimum number
of guesses.
There is no limit on number of guesses.
Example:
If the User inputs range, let’s say from 1 to 100. And System
randomly selected 42 as the integer.
Now the guessing game started, if the user entered 50 as
his/her first guess. The compiler shows “Try Again! You
guessed too high”.
Now the second guess started.
19. 19
Algorithm:
Step 1: Start the program.
Step 2: Read the range of integers Start, End.
Step 3: Set num = random number from Start to End.
Step 4: Set =1
Step 5: Read the Guess number as G
Step 6: If G=num then print ‘you win in the ith guess’
Step 7: Else If G>num the print ‘your guess is too high’ go to step
5.
Step 8: Else print ‘your guess is too low’ go to step 5.
Step 9: Stop the program.
20. 20
Pseudo code:
READ Start, End
SET num=Random(Start, End)
SET i =1
LOOP:
READ G
IF G=num THEN
PRINT ‘You win in ith turn’
EXIT
ELSEIF G>num THEN
PRINT ‘Too High’
ELSE
PRINT ‘Too Low’
i=i+1
ENDLOOP
23. Tower of Hanoi
23
Tower of Hanoi is a mathematical puzzle where we
have three poles (namely A, B, C) and n disks.
The objective of the puzzle is to move the disks from
pole A to Pole C using the Pole B.
simple rules:
1) Only one disk can be moved at a time.
2) Each move consists of taking the upper disk from
one of the poles and placing it on top of another pole
i.e. a disk can only be moved if it is the uppermost
disk on a pole.
3) No disk may be placed on top of a smaller disk.
26. 26
Algorithm:
Step 1: Start
Step 2: Read the number of disc n
Step 3: Call the function TOH(n, A, B, C)
Step 4: Stop
Algorithm for Function Definition TOH
Step 1: if n==1 then Move disc from A to C and
go to step 5 else continue with step 2
Step 2: Call the function TOH(n-1,A,C,B)
Step 3: Move disc n from A to C
Step 4: Call the function TOH(n-1,B,A,C)
Step 5: Return
27. 27
Pseudo code:
READ n
CALL TOH(n,A,B,C)
Function Definition TOH(n, A, B, C)
IF n==1
Move disc from A to C
return
ELSE
CALL TOH(n-1,A,C,B)
Move disc n from A to C
CALL TOH(n-1,B,A,C)
Return