In this chapter we will discuss one recommended practice for efficiently solving computer programming problems and make a demonstration with appropriate examples. We will discuss the basic engineering principles of problem solving, why we should follow them when solving computer programming problems (the same principles can also be applied to find the solutions of many mathematical and scientific problems as well) and we will make an example of their use. We will describe the steps, in which we should go in order to solve some sample problems and show the mistakes that can occur when we do not follow these same steps. We will pay attention to some important steps from the methodology of problem solving, that we usually skip, e.g. the testing. We hope to be able to prove you, with proper examples, that the solving of computer programming problems has a "recipe" and it is very useful.
Introducing the maths toolbox to studentsKevin Cummins
This presentation introduces the 12 math problem solving strategies for students to assist them across all areas of mathematics. This free teaching resource is from Innovative Teaching Resources. You can access hundreds of their excellent resources here. https://www.teacherspayteachers.com/Store/Innovative-Teaching-Ideas
Research methodology and the steps to follow while carrying out research. Literature review, how to do technical paper writing. how to choose research problem.
Ehsan Noursalehi gave a Guerrilla Startup talk hosted by the Illini Entrepreneurship Network. The talk was all about creativity and how it applies to startups. How can you sustain creative efforts over an extended period of time? For those of you that missed it, here are some of the brainstorming Do's and Don'ts:
17. Java data structures trees representation and traversalIntro C# Book
In this chapter we will discuss tree data structures, like trees and graphs. The abilities of these data structures are really important for the modern programming. Each of this data structures is used for building a model of real life problems, which are efficiently solved using this model.
In this chapter we review the basic rules and recommendations for writing quality program code. We pay attention to naming the identifiers in the program (variables, methods, parameters, classes, etc.), formatting and code organization rules, good practices for composing methods, and principles for writing quality documentation.
Introducing the maths toolbox to studentsKevin Cummins
This presentation introduces the 12 math problem solving strategies for students to assist them across all areas of mathematics. This free teaching resource is from Innovative Teaching Resources. You can access hundreds of their excellent resources here. https://www.teacherspayteachers.com/Store/Innovative-Teaching-Ideas
Research methodology and the steps to follow while carrying out research. Literature review, how to do technical paper writing. how to choose research problem.
Ehsan Noursalehi gave a Guerrilla Startup talk hosted by the Illini Entrepreneurship Network. The talk was all about creativity and how it applies to startups. How can you sustain creative efforts over an extended period of time? For those of you that missed it, here are some of the brainstorming Do's and Don'ts:
17. Java data structures trees representation and traversalIntro C# Book
In this chapter we will discuss tree data structures, like trees and graphs. The abilities of these data structures are really important for the modern programming. Each of this data structures is used for building a model of real life problems, which are efficiently solved using this model.
In this chapter we review the basic rules and recommendations for writing quality program code. We pay attention to naming the identifiers in the program (variables, methods, parameters, classes, etc.), formatting and code organization rules, good practices for composing methods, and principles for writing quality documentation.
Here we are going to learn why is a good practice to use interfaces and how they are different from abstraction classes. Further more we are going to see how which one of them to use.
19. Java data structures algorithms and complexityIntro C# Book
In this chapter we will compare the data structures we have learned so far by the performance (execution speed) of the basic operations (addition, search, deletion, etc.). We will give specific tips in what situations what data structures to use.
In this chapter we will understand how to define custom classes and their elements. We will learn to declare fields, constructors and properties for the classes. We will revise what a method is and we will broaden our knowledge about access modifiers and methods.
In this chapter we will explore strings. We are going to explain how they are implemented in Java and in what way we can process text content. Additionally, we will go through different methods for manipulating a text: we will learn how to compare strings, how to search for substrings, how to extract substrings upon previously settled parameters and last but not least how to split a string by separator chars. We will demonstrate how to correctly build strings with the StringBuilder class. We will provide a short but very useful information for the most commonly used regular expressions.
In this chapter we will discuss exceptions in the object-oriented programming and in Java in particular. We will learn how to handle exceptions using the try-catch construct, how to pass them to the calling methods and how to throw standard or our own exceptions using the throw construct.
Here we are going to take a look how to use for loop, foreach loop and while loop. Also we are going to learn how to use and invoke methods and how to define classes in Java programming language.
03 and 04 .Operators, Expressions, working with the console and conditional s...Intro C# Book
In this chapter we will get acquainted with the operators in Java and the actions they can perform on the different data types. We will explain the priorities of the operators and we will analyze the different types of operators, according to the count of the arguments they can take and the actions they can perform. In the second part we will examine the conversion of data types.
In this chapter we will get familiar with primitive types and variables in Java – what they are and how to work with them. First we will consider the data types – integer types, real types with floating-point, Boolean, character, string and object type. We will continue with the variables, with their characteristics, how to declare them, how they are assigned a value and what is variable initialization.
01. Introduction to programming with javaIntro C# Book
In this chapter we will take a look at the basic programming terminology and we will write our first Java program. We will familiarize ourselves with programming – what it means and its connection to computers and programming languages.
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesSanjeev Rampal
Talk presented at Kubernetes Community Day, New York, May 2024.
Technical summary of Multi-Cluster Kubernetes Networking architectures with focus on 4 key topics.
1) Key patterns for Multi-cluster architectures
2) Architectural comparison of several OSS/ CNCF projects to address these patterns
3) Evolution trends for the APIs of these projects
4) Some design recommendations & guidelines for adopting/ deploying these solutions.
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC
Ellisha Heppner, Grant Management Lead, presented an update on APNIC Foundation to the PNG DNS Forum held from 6 to 10 May, 2024 in Port Moresby, Papua New Guinea.
This 7-second Brain Wave Ritual Attracts Money To You.!nirahealhty
Discover the power of a simple 7-second brain wave ritual that can attract wealth and abundance into your life. By tapping into specific brain frequencies, this technique helps you manifest financial success effortlessly. Ready to transform your financial future? Try this powerful ritual and start attracting money today!
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBrad Spiegel Macon GA
Brad Spiegel Macon GA’s journey exemplifies the profound impact that one individual can have on their community. Through his unwavering dedication to digital inclusion, he’s not only bridging the gap in Macon but also setting an example for others to follow.
1.Wireless Communication System_Wireless communication is a broad term that i...JeyaPerumal1
Wireless communication involves the transmission of information over a distance without the help of wires, cables or any other forms of electrical conductors.
Wireless communication is a broad term that incorporates all procedures and forms of connecting and communicating between two or more devices using a wireless signal through wireless communication technologies and devices.
Features of Wireless Communication
The evolution of wireless technology has brought many advancements with its effective features.
The transmitted distance can be anywhere between a few meters (for example, a television's remote control) and thousands of kilometers (for example, radio communication).
Wireless communication can be used for cellular telephony, wireless access to the internet, wireless home networking, and so on.
# Internet Security: Safeguarding Your Digital World
In the contemporary digital age, the internet is a cornerstone of our daily lives. It connects us to vast amounts of information, provides platforms for communication, enables commerce, and offers endless entertainment. However, with these conveniences come significant security challenges. Internet security is essential to protect our digital identities, sensitive data, and overall online experience. This comprehensive guide explores the multifaceted world of internet security, providing insights into its importance, common threats, and effective strategies to safeguard your digital world.
## Understanding Internet Security
Internet security encompasses the measures and protocols used to protect information, devices, and networks from unauthorized access, attacks, and damage. It involves a wide range of practices designed to safeguard data confidentiality, integrity, and availability. Effective internet security is crucial for individuals, businesses, and governments alike, as cyber threats continue to evolve in complexity and scale.
### Key Components of Internet Security
1. **Confidentiality**: Ensuring that information is accessible only to those authorized to access it.
2. **Integrity**: Protecting information from being altered or tampered with by unauthorized parties.
3. **Availability**: Ensuring that authorized users have reliable access to information and resources when needed.
## Common Internet Security Threats
Cyber threats are numerous and constantly evolving. Understanding these threats is the first step in protecting against them. Some of the most common internet security threats include:
### Malware
Malware, or malicious software, is designed to harm, exploit, or otherwise compromise a device, network, or service. Common types of malware include:
- **Viruses**: Programs that attach themselves to legitimate software and replicate, spreading to other programs and files.
- **Worms**: Standalone malware that replicates itself to spread to other computers.
- **Trojan Horses**: Malicious software disguised as legitimate software.
- **Ransomware**: Malware that encrypts a user's files and demands a ransom for the decryption key.
- **Spyware**: Software that secretly monitors and collects user information.
### Phishing
Phishing is a social engineering attack that aims to steal sensitive information such as usernames, passwords, and credit card details. Attackers often masquerade as trusted entities in email or other communication channels, tricking victims into providing their information.
### Man-in-the-Middle (MitM) Attacks
MitM attacks occur when an attacker intercepts and potentially alters communication between two parties without their knowledge. This can lead to the unauthorized acquisition of sensitive information.
### Denial-of-Service (DoS) and Distributed Denial-of-Service (DDoS) Attacks
3. Table of Content
1. What Is a Problem?
2. Stages of Problem Solving
3. Complexity of a Problem
4. Example Problems
5. From Chaotic to Methodological Approach
3
4. What Is a Problem?
Current and Desired State Diff
5. Definition - a doubtful or difficult matter,
requiring a solution
Goals - anything you wish to achieve,
anywhere you want to be
Barriers - obstacles that prevent the
achievement of goals
What Is a Problem?
5
Without goals and barriers
there is no problem
7. Define the problem
Analyse the problem
Identify potential solutions
Evaluate and choose the best solution
Plan action
Implement and review results
Solving a Problem
8. What are the steps to cross the street successfully ?
Problem Street Crossing
8
9. Recognizing that there is a problem, identifying the nature
of the problem, defining the problem
Problem Identification
9
Ascertain
the
objective
of the
decision
maker
Understand
the
background
of the
problem
Isolate
and
identify
the
problem
Determine
the unit of
analysis
and the
relevant
variables
State and
research
the
objective
10. Observation
Inspection
Fact-finding
Developing a clear picture
of the problem
Structure of the Problem
10
11. Generating a range of possible courses of action and trying to
evaluate them
Analyzing the different possible solutions and choosing the
best one
Solutions and Decisions
11
12. Connect all the nine dots,
using only 4 lines
Nine Dots Problem
12
13. Let's think outside the box!
What has changed?
Our point of view
Nine Dots Problem
13
16. You are mixing cement and the recipe calls for five gallons of water
You have a garden hose giving you all the water you need
The problem is that you only have a four-gallon bucket and
a seven-gallon bucket and neither has graduation marks
Find a method to measure five gallons
Five Gallons
16
4 gal 7 gal
17. You have 10 stacks of 10 gold coins
All the coins in one of these stacks are counterfeit,
all the other coins are not
A real coin weighs 10 grams
A counterfeit coin weighs 11 grams
You can use an extremely
accurate digital weighing machine only once
How do you determine which set of
10 coins is faulty?
10 Piles of 10 Coins One of Which Is Fake
17
20. The Missing Piece
20
The gradient of the teal hypotenuse is different than the
gradient of the red hypotenuse
21. Fill the 4-gallon bucket
Empty the 4-gallon bucket into the 7-gallon bucket
Fill the 4-gallon bucket
Pour the 3 gallons from the 4-gallon bucket
into the 7-gallon bucket
Empty the 7-gallon bucket
Pour the 1 gallon from the 4-gallon bucket into the 7-gallon bucket
Fill the 4-gallon bucket
Empty the 4-gallon bucket into the 7-gallon bucket
We have solved the problem
Five Gallons
21
0 gal
0 gal
4 gal 4 gal
1 gal
7 gal1 gal
5 gal
22. We take one coin from pile #1, two coins from pile #2, three coins
from pile #3 and so on until we have 10 coins from pile #10
This gives us 55 coins which if they were all pure would give us 550g
10 Piles of 10 Coins One of Which Is Fake (1)
22
23. 10 Piles of 10 Coins One of Which Is Fake (2)
23
However, some of them will be fake
Let's say we place them all on the scale, for our one and only
weighing, and it reads 553g
The only possible way this could have happened is if we placed
3 counterfeit coins on the balance, and that means that
pile #3 is counterfeit
25. Read and Analyze the Problems
25
Consider you are at a computer programming exam or contest
You have 5 problems to solve in 6 hours
First read carefully all problems and try to estimate how
complex each of them is
Read the requirements, don't invent them!
Start solving the easiest / fastest to solve problem first!
Leave the most complex / slow to solve problem last!
Approach the next problem when the previous is well tested
26. Use a Sheet of Paper and a Pen
26
Never start solving a problem without a sheet of paper + a pen
You need to sketch your ideas
Paper and pen is the best visualization tool
Allows your brain to think efficiently
Paper works faster than keyboard / screen
Other visualization tools could also work well
27. Prefer Squared Paper
27
Squared paper works best for
algorithmic problems
Easy to draw a table
Easy to draw a coordinate
system with objects at it
Easy to calculate distances
Easy to sketch a problem and
solution idea
28. Paper and Pen
28
Consider a "Cards Shuffle" problem
We can sketch it to start thinking
Some ideas immediately come, e.g.
Split the deck into two parts and swap them multiple times
Swap 2 random cards a random number of times
Swap each card with a random card
30. Think Up, Invent and Try Ideas
30
First take an example of the problem
Sketch it on the sheet of paper
Next try to invent some idea that works for your example
Check if your idea will work for other examples
Try to find a case that breaks your idea
Try challenging examples and unusual cases
If you find your idea incorrect, try to fix it
Or just invent a new idea
31. Think Up, Invent and Try Ideas
31
Idea #1: random number of times split the deck into left and
right part and swap them
How to represent the cards?
How to choose a random split point?
How to perform the exchange?
Idea #2: swap each card with a random card
How many times to repeat this?
Is this fast enough?
32. Think Up, Invent and Try Ideas
32
Idea #3: swap 2 random cards a random number of times
How to choose two random cards?
How many times to repeat this?
Idea #4: choose a random card and insert it in front of the deck
How to choose random card?
How many times to repeat this?
Idea #5: do you have another idea?
34. Decompose the Problem
34
Work decomposition is natural in engineering
It happens every day in the industry
Projects are decomposed into subprojects
Complex problems could be decomposed into several smaller
sub-problems
Technique known as "Divide and Conquer"
Small problems could easily be solved
Smaller sub-problems could be further decomposed as well
35. Divide and Conquer – Example
35
Let's try idea #1:
Split the deck into left and right part and swap them
(many times)
Divide and conquer
Sub-problem #1 (single exchange) – split the deck into two
random parts and exchange them
Sub-problem #2 – choosing a random split point
Sub-problem #3 – combining single exchanges
How many times to perform "single exchange"?
36. Sub-Problem #1 (Single Exchange)
36
Split the deck into two parts at random split point
And exchange these 2 parts
We visualize this by paper and pen:
37. Sub-Problem #2 (Single Exchange)
37
Choosing a random split point
Need to understand the concept of pseudo-random numbers
and how to use it
In Internet lots of examples are available, some of them incorrect
The class System.Random can do the job
Important detail is that the Random class should be
instantiated only once
Not at each random number generation
38. Sub-Problem #3 (Single Exchange)
38
Combining a sequence of single exchanges to solve
the initial problem
How many times to perform single exchanges to reliably
randomize the deck?
N times (where N is the number of the cards) seems enough
We have an algorithm:
N times split at random position and exchange the left and right
parts of the deck
40. Check-Up Your Ideas
40
Check-up your ideas with examples
It is better to find a problem before the idea is implemented
When the code is written, changing your ideas radically costs a
lot of time and effort
Carefully select examples for check-up
Examples should be simple enough to be checked
by hand in a minute
Examples should be complex enough to cover the most general
case, not just an isolated case
41. Check-Up Your Ideas – Example
41
Let's check the idea:
After 3 random splits and swaps we obtain the start position
Seems like a serious problem!
42. Invent New Idea If Needed
42
What to do when you find your idea is not working in all cases?
Try to fix your idea
Sometimes a small change could fix the problem
Invent new idea and carefully check it
Iterate
Usually your first idea is not the best
Invent ideas, check them, try various cases, find problems,
fix them, invent better ideas, etc.
43. Invent New Ideas – Example
43
Invent a few new ideas:
New idea #1 – multiple times select 2 random cards and
exchange them
New idea #2 – multiple times select a random card and
exchange it with the first card
New idea #3 – multiple times select a random card and move it
to an external list
Let's check the new idea #2
Is it correct?
46. Start Coding: Checklist
46
Never start coding before you find a correct idea that will meet
the requirements
What shall you write before you have a correct idea?
Checklist to follow before start of coding:
Ensure you understand the requirements well
Ensure you have come up a good idea
Ensure your idea is correct
Ensure you know what data structures to use
Ensure the performance will be sufficient
47. Implement Your Algorithm Step-By-Step
47
"Step-by-step" approach is always better than
"build all, then test"
Implement a piece of your program and test it
Then implement another piece of the program and test it
Finally put together all pieces and test it
Small increments (steps) reveal errors early
"Big bang" integration takes more time
49. Thoroughly Test Your Solution
49
Always test thoroughly your solution
Invest in testing!
One 90-100% solved problem could be better than 2 or 3
partially solved
Testing an existing problem takes less time than solving another
problem from scratch
50. How to Test?
50
Testing could not certify absence of defects
It just reduces the defects’ rates
Well tested solutions are more likely to be correct
Start testing with a good representative of the general case
Not a small isolated case, but a typical one
Large enough test case, but small enough to be easily checkable
51. Read the Problem Statement
51
Read carefully the problem statement
Does your solution print exactly what is expected?
Does your output follow the requested format?
Did you remove your debug printouts?
Be sure to solve the requested problem, not the problem
you think is requested!
Example: "Write a program to print the number of
permutations of n elements" means to print a single number,
not a set of permutations!
52. …
…
…
Summary
52
Problem solving needs methodology:
Understanding and analyzing problems
Using a sheet of paper and a pen for sketching
Thinking up, inventing and trying ideas
Decomposing problems into sub-problems
Selecting appropriate data structures
Thinking about the efficiency and performance
Implementing step-by-step
Testing the nominal case, border cases and efficiency