Q1. Write and test a program to sort the following array of 10 integer numbers using Selection Sort . Calculate the numbers of times the outer loop, inner loop, if statement and and swap operation will execute in this example. Show all the intermediate steps.
15 | 45 | 60 | 25 | 35 | 8 | 40 | 5 | 10 | 27 |
Answer : -
#include<stdio.h>
int main()
Output :
outer-loop execute 9 times inner-loop execute 45 times if-statement execute 22 times swap-operation execute 8 times |
Q2. Implement Binary Search algorithm to search for a number 70 in the following sorted array of 10 integer numbers. Calculate the total no of mid operations, if statement and else if comparison operations and the number of times the loop will execute.
5 | 10 | 25 | 30 | 37 | 46 | 55 | 60 | 65 | 70 |
Answer : -
#include<stdio.h>
int main()
Output :
|
Q3. Write a program to traverse a graph using DFS. Apply this algorithm to the following graph and write the sequence of vertices to be travelled. Also calculate the number of times the for loop and if condition will execute in this example.
Answer : - Graph not present in the assignment's question paper. Therefore, solution is not possible.
If you want to learn DFS Algorithm and its Programming then click the link given below -
Depth First Search (DFS)
Q4. Write a program to find the maximum of the following list of integer numbers : 15, 20, 5, 4, 3, 17, 35.
Calculate (i) the number of times the loop will execute and (ii) the number of times the if statement will run in this example.
Answer : -
#include<stdio.h>
int main()
Output :
|
Q5. Implement Prim’s algorithm to find a minimum cost spanning tree of the following graph and print the result . Represent the graph through adjacency matrix,
Answer : - Coming Soon
Adjacency Matrix
Q6. Implement Horner's rule for evaluating the following polynomial expression at x = 5. Calculate the total number of times addition and multiplication operations will ocuur in this example
p(x) = 3x5 - 4x4 + 5x3 -6x + 9
Answer : - Coming Soon
Q7. Write a program to count the number of times an integer number 12 has occurred in the following array of 10 integer numbers.
15, 20, 35, 12, 11, 8 ,12, 7, 12, 16
Calculate the number of times (i) loop statement and (ii) increment operations will execute in this example.
Answer : -
#include<stdio.h>
int main()
Output :
|
ABOUT US QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries. Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions. Moreover, QuestionSolves.com provides solutions to your questions and assignments also. | ||||||||||
MORE TOPIC Windows Command UNIX Command IGNOU Assignment Solution IGNOU Question Paper Solution | ||||||||||
WHAT WE DO Website Devlopment Training Home Learning Provide BCA, MCA Projects Provide Assignment & Question Paper Solution | ||||||||||
CONTACT US
|