NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

CA-C2T: PROBLEM SOLVING TECHNIQUES

Two Mark Questions
1) Define algorithm?
It is a step by step procedure of solving a
problem. Ex: Step 1 : Start
Step 2 : Input a,b
Step 3 : Calculate
c=a+b Step 4 :
Output c
Step 5 : Stop
2) “Algorithms as a technology” justify?
 Algorithm are a very important topic in a computer science because they help software
developers create efficient and error free programs. It is not a dependent on any
programming language,that is why algorithm, like computer hardware, are considered
technology.
3) Define growth of an algorithm?
The growth of an algorithm is a way to predict how execution time of an program and
memory size change with input size. Ex: Big oh notation.
4) Mention any 2 advantages of algorithm?
 An algorithms are very easy to understand.
● Algorithm is machine independent & programming language independent.
5) What are asymptotic notation?
The commonly used notation for calculating the running time complexity of the
algorithm is as follows.
 Big Theta (Θ)
 Big Oh(O)
 Big Omega (Ω)

Long Answers ( 4M / 5M / 8 M Questions )
1) Explain the steps in analysis and designing algorithm?
 Each and every instruction should be precise and unambiguous.
 Each instruction should be performed in finite amount of time.
 Algorithm must have finite number of steps.
 No instruction should be repeated infinitely.
 An algorithm must take at least zero, one (or) more input values
 An algorithm must produce at least one (or) more output values.
2) Explain the asymptotic notation and standard notation?
The commonly used notation for calculating the running time complexity of the
algorithm is as follows:
 Big Theta (Θ) : The notation theta (n) is the formal way to express both the lower bound
and the upper bound of an algorithms running time.
 Big Oh(O) : It is used to measure the performance or complexity of an algorithm. It is
the upper bound of the growth rate of a function.
 Big Omega (Ω): The notation omega (Ω) is the formal way to express the lower bound
of an algorithm running time. It measure the best case time complexity or the best
amount of time an algorithm can possibly take to complete.
3) Write an algorithm to exchange 2 variable?
Step-1: Start
Step-2: Input A,
B
Step-3: Output A, B // before
swapping Step-4: Temp = A
A = B
B = Temp
Step-5: Output A, B //After
swapping Step-6 : Stop
3) Write an algorithm to find factorial of a number.

Step-1: Start
Step-2: Read
N Step-3:
Fact=1
Step-4: For I=1 to N do
Fact=Fact* I
End for
Step-5: Print
Fact Step-6:
Stop

4) Write an algorithm to generate Fibonacci series

Step-1: Start
Step-2: Input
N
Step-3: F=0 , S = 1, I = 3
Step-4 : Output F, S

Step-4: Repeat step 5 to step 9 until I
<= N Step-5: NXT = F + S
Step-6: Output
NXT Step-7: F =
S
Step-8: S =
NXT Step-9: I
= I + 1
Step-10: Stop

5) Write an algorithm to reverse the digit of an integer .

Step-1: Start
Step-2: Input
num Step-3:
rev=0
Step-4: Repeat step 5 to step 7 until
num>0 Step-5: rem=num%10
Step-6: rev= rev*10 +
rem Step-7: num =
num/10 Step-8: Output
rev
Step-9: Stop

6) Write an algorithm to convert character to a Number using ASCII code.

Step-1: Start
Step-2: Input
Ch.
Step-3: num_c=65 num_s=97
Step-4: If (Ch=’A’) then
num_c=65
Else if (Ch=’B’) then
num_c=num_c+1 Else if (Ch=’C’)
then num_c=num_c+2
.
.
.
Else if (Ch=’Z’) then num_c=num_c+25
End if
Step-5: If (Ch=’a’) then num_s=65
Else if (Ch=’b’) then
num_s=num_s+1 Else if (Ch=’c’)
then num_s=num_s+2
.
.
.
Else if (Ch=’z’) then num_s=num_s+25
End if
Step-6: Output num_c,
num_s Step-7: Stop
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.