0% found this document useful (0 votes)
28 views1 page

Solve Following Programming Problems:: (There Will Be 10% Class Evaluation in Lab 3 Based On Lab 1 and Lab 2)

The document provides instructions for a data structures lab assignment involving sorting and searching algorithms. Students are asked to: 1) Generate 50,000 random integers and write them to a file. 2) Sort the integers in the file using insertion sort and save to a new file. 3) Time the insertion sort algorithm. 4) Perform linear search on the sorted data, defining functions for input, search, and output. The last paragraph notes the lab will be 10% of the class evaluation.

Uploaded by

Ameek ghuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Solve Following Programming Problems:: (There Will Be 10% Class Evaluation in Lab 3 Based On Lab 1 and Lab 2)

The document provides instructions for a data structures lab assignment involving sorting and searching algorithms. Students are asked to: 1) Generate 50,000 random integers and write them to a file. 2) Sort the integers in the file using insertion sort and save to a new file. 3) Time the insertion sort algorithm. 4) Perform linear search on the sorted data, defining functions for input, search, and output. The last paragraph notes the lab will be 10% of the class evaluation.

Uploaded by

Ameek ghuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
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 – 02

Solve following Programming Problems:

1. WAP that will randomly generate 50000 integer numbers in the range -250 to 249. 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 insertion sort. Use separate
function for INSERTION_SORT. Call it from main function. Save the sorted output into another text
file named “out.txt”.

3. Find the actual running time of insertion-sort for the given input. [use time.h header, clock variable
and clock function]

Pseudocode:

4. Now do linear search on the data in “out.txt”. Maintain following separate functions:

a. input // read all integers from “out.txt” and load it into an array
(for array, perform dynamic memory allocation)
b. lin_search // do linear search against a KEY integer and return its index / array position
// if not found then return -1
c. show // Show search result (found or not found)

[There will be 10% class evaluation in Lab 3 based on Lab 1 and Lab 2]

Page 1 of 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy