Spring Term 2003 Unified Engineering Problem Set, Exercises of Computer Engineering and Programming

A problem set for the unified engineering course during the spring term 2003. The problem set includes questions related to minimum spanning trees using prim's and kruskal's algorithm, computation complexity of bubble sort, insertion into singly linked lists, and designing and implementing an ada95 package for reading and sorting integers. The document also includes instructions for turning in the assignments.

Typology: Exercises

2011/2012

Uploaded on 07/20/2012

savitri_85
savitri_85 🇮🇳

4

(5)

70 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Unified Engineering Spring Term 2003Unified Engineering Spring Term 2003
CP7_10
The problems in this problem set cover lectures C7, C8, C9 and C10
1. What is the Minimum Spanning Tree of the graph shown below using both Prim’s and
Kruskal’s algorithm. Show all the steps in the computation of the MST (not just the final
MST).
2. Compute the computation complexity of the bubble sort algorithm. Show all the steps
in the computation based on the algorithm.
3. What are the best case and worst case computation complexity of:
a. Inserting a node into an unsorted singly linked list
b. Inserting a node into a sorted singly linked list
Show the steps in the complexity computation based on the algorithm and justify your
answer by using a diagram of the insertion operation.
4.
a. Design an Ada95 Package to:
i. Read in N integers from an input file into an array. (N is user defined <=50)
ii. Sort the array in ascending order
iii. Perform binary search on the array.
b. Write a program to test your package that will
- Prompt the user for a number to search for.
- If the number is found using the binary search algorithm
docsity.com
pf2

Partial preview of the text

Download Spring Term 2003 Unified Engineering Problem Set and more Exercises Computer Engineering and Programming in PDF only on Docsity!

Unified EngineeringUnified Engineering Spring Term 2003Spring Term 2003

CP7_ 10

The problems in this problem set cover lectures C7, C8, C9 and C

  1. What is the Minimum Spanning Tree of the graph shown below using both Prim’s and Kruskal’s algorithm. Show all the steps in the computation of the MST (not just the final MST).
  2. Compute the computation complexity of the bubble sort algorithm. Show all the steps in the computation based on the algorithm.
  3. What are the best case and worst case computation complexity of:

a. Inserting a node into an unsorted singly linked list b. Inserting a node into a sorted singly linked list

Show the steps in the complexity computation based on the algorithm and justify your answer by using a diagram of the insertion operation.

a. Design an Ada95 Package to: i. Read in N integers from an input file into an array. (N is user defined <=50) ii. Sort the array in ascending order iii. Perform binary search on the array.

b. Write a program to test your package that will

  • Prompt the user for a number to search for.
  • If the number is found using the binary search algorithm

docsity.com

  • Display the location (index)
  • Display the number
  • If the number is not found using the binary search algorithm
  • Display “Number not in array” to the user

Turn in an electronic copy of your Package and test program and a hard copy of your algorithm and code listing. Assume: Input file name is my_input.txt

  1. Implement the merge sort algorithm as an Ada95 program. Your program should
    • Read in N integers from an input file. (N is user defined <=50)
    • Sort using your merge sort implementation.
    • Display the sorted and unsorted inputs to the user

Turn in an electronic copy of your code and a hard copy of your algorithm and code listing. Assume: Input file name is my_input.txt

docsity.com