You are on page 1of 1

United International University (UIU)

Dept. of Computer Science and Engineering


Data Structures Laboratory
Course Code: CSI-218
Semester: Summer-2014
Lab – 01

Solve following Programming Problems:

1. WAP that will randomly generate 500 integer numbers in the range 0 to 999. Write those numbers in
a text file named “in.txt”.

2. Sort (in ascending order) all the integer numbers in the file “in.txt” using bubble sort. Use separate
function for SWAP and BUBBLE_SORT. Call them from main function.

United International University (UIU)


Dept. of Computer Science and Engineering
Data Structures Laboratory
Course Code: CSI-218
Semester: Summer-2014
Home Task – 01

Solve following Programming Problems:

1. WAP that will randomly generate 10000 integer numbers in the range 0 to 499. Write those numbers
in a text file named “in.txt”.

2. Sort (in descending order) all the integer numbers in the file “in.txt” using bubble sort.

3. Sort (in ascending order) all the integer numbers in the file “in.txt” using selection sort.
(Try to write separate function for SWAP and SELECTION_SORT and call them from main
function. Also analyze its abstract running time.)
IDEA: First find 1st maximum and swap it with the last element, then find 2nd maximum and swap
it with 2nd last element and so on.

Page 1 of 1

You might also like