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

Data - Structure Lab - 01

The document provides instructions for two programming assignments for a data structures laboratory course. The first assignment asks students to generate random numbers in a file and sort them in ascending order using bubble sort. The second assignment asks students to generate more random numbers in a file and sort them using bubble sort in descending order and selection sort in ascending order.

Uploaded by

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

Data - Structure Lab - 01

The document provides instructions for two programming assignments for a data structures laboratory course. The first assignment asks students to generate random numbers in a file and sort them in ascending order using bubble sort. The second assignment asks students to generate more random numbers in a file and sort them using bubble sort in descending order and selection sort in ascending order.

Uploaded by

Ameek ghuri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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