SlideShare a Scribd company logo
1 of 25
Download to read offline
www.webstackacademy.com
Problem Solving
JavaScript
www.webstackacademy.comwww.webstackacademy.com
Problem Solving
www.webstackacademy.com
Problem Solving – What?
• An approach which could be taken to reach to a solution
• The approach could be ad hoc or generic with a proper order
• Sometimes it requires a creative and out of the box thinking to reach to perfect
solution
www.webstackacademy.com
BCD
Problem Solving
A
 Introduction to SDLC
 Polya’s Rules
 Algorithm Design methods
www.webstackacademy.com
BCD
Problem Solving
A
 A Quick introduction to SDLC
 Never jump into implementation – Why?
o You might not have the clarity of the application
o You might have some loose ends in the requirements
o Complete picture of the application could be missing and many more...
www.webstackacademy.com
Test
Code
Design
Requirement
• Understand requirements properly
• Consider all possible I/P and O/P
• Know boundary conditions
• Get it verified
• Implement code based on the
design
• Try to have maximum
modularity
• Coding practices like –
Indentation, Commenting,
Variable naming convention,
Neat file and function headers
• Have a proper design plan
• Use some algorithm
• Use pen and paper method
• Use flow chart (if required)
• Make sure all cases are covered
• Test the implementation
thoroughly
• Capture all possible cases
• Have neat output presentation
• Requirements -> Output trace
SDLC - Phases
www.webstackacademy.com
BCD
Problem Solving – How?
A
 Polya’s rule:
o Understand the problem
o Devise a plan
o Carry out the plan
o Look back
www.webstackacademy.com
BCD
Problem Solving – Algorithm – What?
A
 A procedure or formula for solving a problem
 A sequence of unambiguous instructions for solving a problem. This means obtaining a required output for
any legitimate input in a finite amount of time
 Algorithms is needed to generate correct output in finite time in a given constrained environment:
o Correctness of output
o Finite time
o Better Prediction
 Steps to take:
o Natural language (Step-by-step)
o Pseudo codes
o Flowcharts
www.webstackacademy.com
BCD
Problem Solving – Daily life example
A
 Let's consider a problem of reaching this room
 The different possible approach could be thought of
 Take a Walk
 Take a Bus
 Take a Car
 Let's Pool
 Lets discuss the above approaches in bit detail
www.webstackacademy.com
BCD
Algorithm – Reaching this room – Take a walk
A
 The steps could be like
o Start a 8 AM
o Walk through street X for 500 Mts
o Take a left on main road and walk for 2 KM
o Take a left again and walk 200 Mts to reach
 Pros
o You might say walking is a good exercise :)
o Might have good time prediction
o Save some penny
 Cons
o Depends on where you stay (you would choose if you stay closer)
o Should start early
o Would get tired
o Freshness would have gone
www.webstackacademy.com
BCD
Algorithm – Reaching this room – Take a bus
A
 The steps could be like
o Start a 8.30 AM
o Walk through street X for 500 Mts
o Take a left on main road and walk for 100 Mts to bus stop
o Take Bus No 111 and get down at stop X and walk for 100 Mts
o Take a left again and walk 200 Mts to reach
 Pros
o You might save some time
o Less tiredness comparatively
 Cons
o Have to walk to the bus stop
o Have to wait for the right bus (No prediction of time)
o Might not be comfortable on rush hours
www.webstackacademy.com
BCD
Algorithm – Reaching the room – Take a car
A
 The steps could be like
o Start a 9 AM
o Drive through street X for 500 Mts
o Take a left on main road and drive 2 KM
o Take a left again and drive 200 Mts to reach+
 Pros
o Proper control of time and most comfortable
o Less tiresome
 Cons
o Could have issues on traffic congestions
o Will be costly
www.webstackacademy.com
BCD
Algorithm – Reaching the room – Let’s pool
A
 The steps could be like
o Start a 8.45 AM
o Walk through street X for 500 Mts
o Reach the main road wait for you partner
o Drive for 2 KM on the main road
o Take a left again and drive 200 Mts to reach
 Pros
o You might save some time
o Less costly comparatively
 Cons
o Have to wait for partner to reach
o Could have issues on traffic congestions
www.webstackacademy.com
BCD
Algorithm – Reaching the room – Conclusion
A
 All the above solution eventually will lead you to this room
 Every approach some pros and cons
 It would be our duty as a designer to take the best approach for the given problem
www.webstackacademy.com
BCD
Algorithm – A computer example
A
 Let's consider a problem of adding two numbers
 The steps involved :
o Start
o Read the value of A and B
o Add A and B and store in SUM
o Display SUM
o Stop
 The above 5 steps would eventually will give us the expected result
www.webstackacademy.com
BCD
Algorithm – Pseudo code
A
 Let's consider a problem of adding two numbers
 The steps involved :
BEGIN
Read A, B
SUM = A + B
Print SUM
END
 The above 5 steps would eventually will give us the expected result
www.webstackacademy.com
BCD
Algorithm – Flowcharts
A
www.webstackacademy.com
BCD
Algorithm – DIY - Pattern
A
 Write an algorithm to print the below pattern
www.webstackacademy.com
BCD
Algorithm – DIY - Pattern
A
 Write an algorithm to print the below number pyramid
www.webstackacademy.com
BCD
Algorithm – DIY - Pattern
A
 Write an algorithm to print the below number pyramid
www.webstackacademy.com
BCD
Algorithm – DIY – Try the following
A
 Finding largest of 2 numbers
 Find the largest member of an array
 Count the number of vowels
 Count the number of occurrences of each vowel
 To find the sum of n – natural numbers
 Convert a number from base 10 to base N
www.webstackacademy.com
BCD
Algorithm – DIY – Try the following
A
 Finding largest of 2 numbers
 Find the largest member of an array
 Count the number of vowels
 Count the number of occurrences of each vowel
 To find the sum of n – natural numbers
 Convert a number from base 10 to base N
www.webstackacademy.com
BCD
Algorithm – DIY – Try the following
A
Sand Timers: You have two sand timers, which can show 4 minutes and 7 minutes respectively. Use both the
sand timers (at a time or one after other or any other combination) and measure a time of 9 minutes.
www.webstackacademy.com
BCD
Algorithm – DIY – Try the following
A
Mad men in a circle: N persons (given as the input by the user) are standing in a circle. They are labeled from 1
to N in clockwise order. The first person is holding a gun, will shoot a person on his right and pass the gun to the
next person who is alive.
• Assuming N = 100, what is the index of the last person who will be alive?
• Can you write a generic algorithm which can handle N value up-to 1000?
• Can you validate your output by writing a JavaScript program?
www.webstackacademy.com
WebStack Academy
#83, Farah Towers,
1st Floor, MG Road,
Bangalore – 560001
M: +91-809 555 7332
E: training@webstackacademy.com
WSA in Social Media:

More Related Content

What's hot

Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Aaron Gustafson
 
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScriptpcnmtutorials
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript TutorialBui Kiet
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An IntroductionManvendra Singh
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn Calvert
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - ObjectsWebStackAcademy
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom ManipulationMohammed Arif
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScriptT11 Sessions
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced FunctionsWebStackAcademy
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation洪 鹏发
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptAmit Tyagi
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSSSyed Sami
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - OperatorsWebStackAcademy
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)WebStackAcademy
 

What's hot (20)

Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSS
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 

Similar to JavaScript - Chapter 1 - Problem Solving

Understanding computer vision with Deep Learning
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep LearningCloudxLab
 
Understanding computer vision with Deep Learning
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep Learningknowbigdata
 
Understanding computer vision with Deep Learning
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep LearningShubhWadekar
 
Honors methods of motion-day 8-per4
Honors methods of motion-day 8-per4Honors methods of motion-day 8-per4
Honors methods of motion-day 8-per4stephm32
 
DynamicProgramming.pptx
DynamicProgramming.pptxDynamicProgramming.pptx
DynamicProgramming.pptxSaimaShaheen14
 
20 Ideas On How To Improve Your Agile Board
20 Ideas On How To Improve Your Agile Board20 Ideas On How To Improve Your Agile Board
20 Ideas On How To Improve Your Agile BoardMarcus Hammarberg
 
Believe it or not, Aptera the car of the future
Believe it or not, Aptera the car of the futureBelieve it or not, Aptera the car of the future
Believe it or not, Aptera the car of the futureJavier Cárdenas
 
CompEng - Lec02 - Optimum Design Problem Formulation.pdf
CompEng - Lec02 - Optimum Design Problem Formulation.pdfCompEng - Lec02 - Optimum Design Problem Formulation.pdf
CompEng - Lec02 - Optimum Design Problem Formulation.pdfnooreldeenmagdy2
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptSourabhPal46
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptMard Geer
 
PyData Amsterdam - Name Matching at Scale
PyData Amsterdam - Name Matching at ScalePyData Amsterdam - Name Matching at Scale
PyData Amsterdam - Name Matching at ScaleGoDataDriven
 
College App Essay Format - Sample College Admissio
College App Essay Format - Sample College AdmissioCollege App Essay Format - Sample College Admissio
College App Essay Format - Sample College AdmissioMonica Franklin
 
Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Traian Rebedea
 
Why computer programming
Why computer programmingWhy computer programming
Why computer programmingTUOS-Sam
 
Talking about craftsmanship with ensaimadas and katas
Talking about craftsmanship with ensaimadas and katasTalking about craftsmanship with ensaimadas and katas
Talking about craftsmanship with ensaimadas and katasRachel M. Carmena
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheetschriseppstein
 
Training Webinar: Top front-end techniques for OutSystems
 Training Webinar: Top front-end techniques for OutSystems Training Webinar: Top front-end techniques for OutSystems
Training Webinar: Top front-end techniques for OutSystemsOutSystems
 

Similar to JavaScript - Chapter 1 - Problem Solving (20)

Embedded C
Embedded CEmbedded C
Embedded C
 
Understanding computer vision with Deep Learning
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep Learning
 
Understanding computer vision with Deep Learning
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep Learning
 
Understanding computer vision with Deep Learning
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep Learning
 
Honors methods of motion-day 8-per4
Honors methods of motion-day 8-per4Honors methods of motion-day 8-per4
Honors methods of motion-day 8-per4
 
DynamicProgramming.pptx
DynamicProgramming.pptxDynamicProgramming.pptx
DynamicProgramming.pptx
 
20 Ideas On How To Improve Your Agile Board
20 Ideas On How To Improve Your Agile Board20 Ideas On How To Improve Your Agile Board
20 Ideas On How To Improve Your Agile Board
 
Believe it or not, Aptera the car of the future
Believe it or not, Aptera the car of the futureBelieve it or not, Aptera the car of the future
Believe it or not, Aptera the car of the future
 
CompEng - Lec02 - Optimum Design Problem Formulation.pdf
CompEng - Lec02 - Optimum Design Problem Formulation.pdfCompEng - Lec02 - Optimum Design Problem Formulation.pdf
CompEng - Lec02 - Optimum Design Problem Formulation.pdf
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
 
PyData Amsterdam - Name Matching at Scale
PyData Amsterdam - Name Matching at ScalePyData Amsterdam - Name Matching at Scale
PyData Amsterdam - Name Matching at Scale
 
College App Essay Format - Sample College Admissio
College App Essay Format - Sample College AdmissioCollege App Essay Format - Sample College Admissio
College App Essay Format - Sample College Admissio
 
Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2
 
Quality code 2019
Quality code 2019Quality code 2019
Quality code 2019
 
Building mathematicalcraving
Building mathematicalcravingBuilding mathematicalcraving
Building mathematicalcraving
 
Why computer programming
Why computer programmingWhy computer programming
Why computer programming
 
Talking about craftsmanship with ensaimadas and katas
Talking about craftsmanship with ensaimadas and katasTalking about craftsmanship with ensaimadas and katas
Talking about craftsmanship with ensaimadas and katas
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheets
 
Training Webinar: Top front-end techniques for OutSystems
 Training Webinar: Top front-end techniques for OutSystems Training Webinar: Top front-end techniques for OutSystems
Training Webinar: Top front-end techniques for OutSystems
 

More from WebStackAcademy

Webstack Academy - Course Demo Webinar and Placement Journey
Webstack Academy - Course Demo Webinar and Placement JourneyWebstack Academy - Course Demo Webinar and Placement Journey
Webstack Academy - Course Demo Webinar and Placement JourneyWebStackAcademy
 
WSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per SecondWSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per SecondWebStackAcademy
 
WSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer CourseWSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer CourseWebStackAcademy
 
Career Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and OpportunitiesCareer Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and OpportunitiesWebStackAcademy
 
Webstack Academy - Internship Kick Off
Webstack Academy - Internship Kick OffWebstack Academy - Internship Kick Off
Webstack Academy - Internship Kick OffWebStackAcademy
 
Building Your Online Portfolio
Building Your Online PortfolioBuilding Your Online Portfolio
Building Your Online PortfolioWebStackAcademy
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career RoadmapWebStackAcademy
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationWebStackAcademy
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesWebStackAcademy
 
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationWebStackAcademy
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - DirectivesWebStackAcademy
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsWebStackAcademy
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming WebStackAcademy
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - IntroductionWebStackAcademy
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging TechniquesWebStackAcademy
 
JavaScript - Chapter 14 - Form Handling
 JavaScript - Chapter 14 - Form Handling   JavaScript - Chapter 14 - Form Handling
JavaScript - Chapter 14 - Form Handling WebStackAcademy
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object ModelWebStackAcademy
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events WebStackAcademy
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
 

More from WebStackAcademy (20)

Webstack Academy - Course Demo Webinar and Placement Journey
Webstack Academy - Course Demo Webinar and Placement JourneyWebstack Academy - Course Demo Webinar and Placement Journey
Webstack Academy - Course Demo Webinar and Placement Journey
 
WSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per SecondWSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per Second
 
WSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer CourseWSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer Course
 
Career Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and OpportunitiesCareer Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and Opportunities
 
Webstack Academy - Internship Kick Off
Webstack Academy - Internship Kick OffWebstack Academy - Internship Kick Off
Webstack Academy - Internship Kick Off
 
Building Your Online Portfolio
Building Your Online PortfolioBuilding Your Online Portfolio
Building Your Online Portfolio
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career Roadmap
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and Authorization
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase Integration
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - Directives
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging Techniques
 
JavaScript - Chapter 14 - Form Handling
 JavaScript - Chapter 14 - Form Handling   JavaScript - Chapter 14 - Form Handling
JavaScript - Chapter 14 - Form Handling
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

JavaScript - Chapter 1 - Problem Solving

  • 3. www.webstackacademy.com Problem Solving – What? • An approach which could be taken to reach to a solution • The approach could be ad hoc or generic with a proper order • Sometimes it requires a creative and out of the box thinking to reach to perfect solution
  • 4. www.webstackacademy.com BCD Problem Solving A  Introduction to SDLC  Polya’s Rules  Algorithm Design methods
  • 5. www.webstackacademy.com BCD Problem Solving A  A Quick introduction to SDLC  Never jump into implementation – Why? o You might not have the clarity of the application o You might have some loose ends in the requirements o Complete picture of the application could be missing and many more...
  • 6. www.webstackacademy.com Test Code Design Requirement • Understand requirements properly • Consider all possible I/P and O/P • Know boundary conditions • Get it verified • Implement code based on the design • Try to have maximum modularity • Coding practices like – Indentation, Commenting, Variable naming convention, Neat file and function headers • Have a proper design plan • Use some algorithm • Use pen and paper method • Use flow chart (if required) • Make sure all cases are covered • Test the implementation thoroughly • Capture all possible cases • Have neat output presentation • Requirements -> Output trace SDLC - Phases
  • 7. www.webstackacademy.com BCD Problem Solving – How? A  Polya’s rule: o Understand the problem o Devise a plan o Carry out the plan o Look back
  • 8. www.webstackacademy.com BCD Problem Solving – Algorithm – What? A  A procedure or formula for solving a problem  A sequence of unambiguous instructions for solving a problem. This means obtaining a required output for any legitimate input in a finite amount of time  Algorithms is needed to generate correct output in finite time in a given constrained environment: o Correctness of output o Finite time o Better Prediction  Steps to take: o Natural language (Step-by-step) o Pseudo codes o Flowcharts
  • 9. www.webstackacademy.com BCD Problem Solving – Daily life example A  Let's consider a problem of reaching this room  The different possible approach could be thought of  Take a Walk  Take a Bus  Take a Car  Let's Pool  Lets discuss the above approaches in bit detail
  • 10. www.webstackacademy.com BCD Algorithm – Reaching this room – Take a walk A  The steps could be like o Start a 8 AM o Walk through street X for 500 Mts o Take a left on main road and walk for 2 KM o Take a left again and walk 200 Mts to reach  Pros o You might say walking is a good exercise :) o Might have good time prediction o Save some penny  Cons o Depends on where you stay (you would choose if you stay closer) o Should start early o Would get tired o Freshness would have gone
  • 11. www.webstackacademy.com BCD Algorithm – Reaching this room – Take a bus A  The steps could be like o Start a 8.30 AM o Walk through street X for 500 Mts o Take a left on main road and walk for 100 Mts to bus stop o Take Bus No 111 and get down at stop X and walk for 100 Mts o Take a left again and walk 200 Mts to reach  Pros o You might save some time o Less tiredness comparatively  Cons o Have to walk to the bus stop o Have to wait for the right bus (No prediction of time) o Might not be comfortable on rush hours
  • 12. www.webstackacademy.com BCD Algorithm – Reaching the room – Take a car A  The steps could be like o Start a 9 AM o Drive through street X for 500 Mts o Take a left on main road and drive 2 KM o Take a left again and drive 200 Mts to reach+  Pros o Proper control of time and most comfortable o Less tiresome  Cons o Could have issues on traffic congestions o Will be costly
  • 13. www.webstackacademy.com BCD Algorithm – Reaching the room – Let’s pool A  The steps could be like o Start a 8.45 AM o Walk through street X for 500 Mts o Reach the main road wait for you partner o Drive for 2 KM on the main road o Take a left again and drive 200 Mts to reach  Pros o You might save some time o Less costly comparatively  Cons o Have to wait for partner to reach o Could have issues on traffic congestions
  • 14. www.webstackacademy.com BCD Algorithm – Reaching the room – Conclusion A  All the above solution eventually will lead you to this room  Every approach some pros and cons  It would be our duty as a designer to take the best approach for the given problem
  • 15. www.webstackacademy.com BCD Algorithm – A computer example A  Let's consider a problem of adding two numbers  The steps involved : o Start o Read the value of A and B o Add A and B and store in SUM o Display SUM o Stop  The above 5 steps would eventually will give us the expected result
  • 16. www.webstackacademy.com BCD Algorithm – Pseudo code A  Let's consider a problem of adding two numbers  The steps involved : BEGIN Read A, B SUM = A + B Print SUM END  The above 5 steps would eventually will give us the expected result
  • 18. www.webstackacademy.com BCD Algorithm – DIY - Pattern A  Write an algorithm to print the below pattern
  • 19. www.webstackacademy.com BCD Algorithm – DIY - Pattern A  Write an algorithm to print the below number pyramid
  • 20. www.webstackacademy.com BCD Algorithm – DIY - Pattern A  Write an algorithm to print the below number pyramid
  • 21. www.webstackacademy.com BCD Algorithm – DIY – Try the following A  Finding largest of 2 numbers  Find the largest member of an array  Count the number of vowels  Count the number of occurrences of each vowel  To find the sum of n – natural numbers  Convert a number from base 10 to base N
  • 22. www.webstackacademy.com BCD Algorithm – DIY – Try the following A  Finding largest of 2 numbers  Find the largest member of an array  Count the number of vowels  Count the number of occurrences of each vowel  To find the sum of n – natural numbers  Convert a number from base 10 to base N
  • 23. www.webstackacademy.com BCD Algorithm – DIY – Try the following A Sand Timers: You have two sand timers, which can show 4 minutes and 7 minutes respectively. Use both the sand timers (at a time or one after other or any other combination) and measure a time of 9 minutes.
  • 24. www.webstackacademy.com BCD Algorithm – DIY – Try the following A Mad men in a circle: N persons (given as the input by the user) are standing in a circle. They are labeled from 1 to N in clockwise order. The first person is holding a gun, will shoot a person on his right and pass the gun to the next person who is alive. • Assuming N = 100, what is the index of the last person who will be alive? • Can you write a generic algorithm which can handle N value up-to 1000? • Can you validate your output by writing a JavaScript program?
  • 25. www.webstackacademy.com WebStack Academy #83, Farah Towers, 1st Floor, MG Road, Bangalore – 560001 M: +91-809 555 7332 E: training@webstackacademy.com WSA in Social Media: