Term paper assignment

 

Write a program in C which performs some task of your choice.

Hand in (in an envelope with your name and date):

You will also have to present your program to your instructor. Be prepared to answer detailed questions on what and how the program does. You might be asked questions like: "What happens if the code is changed in this way?" or "What modifications are necessary for the code to do this?"

Please write your name in the row corresponding to the project chosen.

No.

Project Description

Name (in block letters)

1

Write a program which constructs a binary tree from a sequence of given numbers. Ask the user for the numbers. Assume all numbers are positive. The user ends the input by entering -1.

 

2

Write a program which given strings s1, s2 and a number n copies the first n characters of s2 to s1. The previous contents of s1 are lost. NOTE: DO NOT use any string functions from the string.h library.

 

3

Write a program which given two strings s1 and s2, adds the string s2 at the end of string s1. NOTE: DO NOT use any string functions from the string.h library.

 

4

Write a program which given two strings s1 and s2, copies the contents of s2 to s1 and returns s1. The previous contents of s1 are lost. NOTE: DO NOT use any string functions from the string.h library.

 

5

Write a program which reads two strings and returns -1 if the first one is shorter, 0 if the two strings are same and 1 if the first string is longer. NOTE: DO NOT use any string functions from the string.h library.

 

6

Write a program which deletes a number from a binary tree. You might want to collaborate with the person writing a function which constructs a binary tree.

 

7

Write a program which replaces all occurrences of number n1 by n2 in a linked list.

 

8

Write a program which takes a linked list and a number n as the input. The linked list is in sorted order. The program inserts the number n in the linked list such that it stays sorted

 

11

Write a program which adds a number n at the end of a given linked list.

 

12

Write a program which deletes a number n from a given linked list.

 

13

Write a program which takes two arrays a1 and a2 as input. The contents of a1 and a2 are already sorted. The program should create a third array a3 which has all the elements of a1 and a2 in sorted order

 

14

Write a program which takes a linked list as an input and prints the contents of the linked list in reverse order.

 

15

Write a program which searches for a number in a linked list.

 

16

Write a program which constructs a linked list from a sequence of given numbers

 

17

Write a program which reads two strings s1 and s2 and which returns how many times s2 occurs in s1.

 

18

Write a program which reads the content of a file and counts the number of occurrences of a given string s1.

 

19

Write a program which reads the content of a file and creates another file by substituting all occurrences of a string s1 with the string s2. The name of the two files and the strings s1 and s2 will be given as parameters on the command line

 

20

Write a program which performs a direct insertion sort on a sequence of numbers.

 

 

 

21

Write a program which performs a bubble sort on a sequence of numbers.

 

22

Write a program which adds a number in a binary tree.

 

 

23

Write a program which performs the binary search of a number in a given sequence. Do not use the library function bsort.

 

24

Write a program which prints the nodes of a binary tree in root-right-left order.

 

25

Write a program which prints the nodes of a binary tree in right-root-left order.

 

26

Write a program which prints the nodes of a binary tree in left-root-right order.

 

27

Write a program which searches for a number in a binary tree.

 

 

28

Write a program which given strings s1, s2 and a number n adds the first n characters of s2 at the end of s1.

 

29

Write a program which reads the content of a file and creates another file by substituting all lower case letters in input file by upper case letters in output file. The name of the two files will be given as parameters on the command line.

 

30

Write a program which takes a file name and a search string s1. Your program should print those lines which contain the string s1 in them.

 

31

Write a program which reads a file and outputs the number of characters, words, lines and paragraphs in it. (Paragraphs are separated by one or more empty lines).

 

32

Write a program which reads two files (say f1 and f2) and creates a new file (say f3) such that f3 has lines alternating from f1 and f2. (i.e. line1 is from f1, line2 from f2, line3 from f1, line4 from f2 etc.)

 

 

 

33

Write a program which takes two files name (say f1 and f2) and two strings (say s1 and s2). The program will copy the file f1 into a new file called f2 substituting s1 with s2 in the process.

 
 

 

 

 
 

 

 

 
 

 

 

 
 

 

 

 
 

 

 

 
 

 

 

 
 

 

 

 

 

If you have chosen a topic different from those above, the topic has to be approved before you start working on the program. Write a concise description of what you want your program to do and present that for approval. You can get it approved by email or by appointment. You cannot do it over the phone.

 

Deadline for submitting the program: 12 December 1997.

Back to the course home page