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

Assignment 1

The document outlines 12 programming assignments involving pseudocode, algorithm complexity analysis, sorting algorithms, recursion, finding common elements in lists, counting list elements, conditional printing based on integer ranges, determining if a number is odd or even, and finding odd numbers in a list.

Uploaded by

SIDDHARTH BANSAL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment 1

The document outlines 12 programming assignments involving pseudocode, algorithm complexity analysis, sorting algorithms, recursion, finding common elements in lists, counting list elements, conditional printing based on integer ranges, determining if a number is odd or even, and finding odd numbers in a list.

Uploaded by

SIDDHARTH BANSAL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment

1. What is Pseudocode. Describe it with an


example.

2. Propose an algorithm (write Pseudocode) to


find the largest integer in the list L= [1: N].

3. The Worst-, Average-, and Best-Case


Complexities of an Algorithm.

4. Suggest the changes in Deferred Acceptance


(matching algorithm) to make suitable for
women proposal.

5. Describe the insertion, bubble, and selection


sorting algorithms with an example. Also
provide their worst-case complexities.

6. Describe Recursion with an example.

7. State difference between Recursion and


Iterative statements.

8. Suggest an algorithm to find the common


integers in the List A and List B. [Let Input= List
A= {2, 5, 7, 14, 23} and List B= {5, 2, 13, 22, 9}. The
output= 2, 5].

9. Propose an algorithm of time complexity O(n)


to count number of elements in the given list.
[Example, Input: List = {1, 3, 67, 78, 34, 23}, then
Output= 6].

10. Create an algorithm (Psudocode) that does


the following: Allow your friend to input an
integer (a number). Print "India" if the number
is between 5 and 15. If the integer is between
15 and 25, write "Srilanka." If the number falls
between 25 and 35, put "USA." If it's a different
number, put I LOVE MY INDIA.

11. Write an algorithm to find if a given number “X”


is odd or even. [Input: 3, then Output: Odd]

12. Write an algorithm of time complexity O(n)


to find all odd numbers in a given list.
[Example, Input: List = {1, 7, 4, 32, 38, 29, 12, 23,
45, 78} then Output = 1, 7, 29, 23, 45].

You might also like