You are on page 1of 4

306: Practical List based on Paper 301

1. Implement Heap Sort.(The program should report the number of comparisons.)


2. Implement Quick sort.(The program should report the number of comparisons.)
3. Implement Randomized Quick sort.(The program should report the number of
comparisons.)
4. Implement Radix Sort.
5. Implement Count Sort.
6. Implement Bucket Sort.
7. Implement Randomized-Select to select ith smallest element from an array of
numbers.(The program should report the number of comparisons.)
8. Create a Red-Black Tree and perform follwoing operations on it:
i) Insert a node
ii) Delete a node
iii) Search for a number & also report the color of the node containing this
number.

9. Implement Order Statistic Tree and the following:


(i) Find the Rank of a number
(ii) Select ith smallest element.
(iii) Select ith element after a number in linear order

10. WAP that prints an optimal parenthesization of a matrix-chain product whose


sequence of dimensions is given.
11. WAP to determine the LCS of two given sequences.
12. Implement Breadth-First Search in a graph.
13. Implement Depth-First Search in a graph.
14. WAP to determine the minimum spanning tree of a graph.
15. Implement Strassen’s algorithm for Matrix Multiplication. (Take 2x2 Matrix).
16. WAP that finds LUP decomposition of a Matrix.
17. ** Implement Interval Trees.
18. ** Implement Huffman Coding.

Practical list - 306 (Based on 302 - Shell & Javascript)


Shell Programming

1. Write a Shell program to send you a reminder mails for upcoming events (events
happening today and tomorrow).
2. Write a Shell program that folds lines of text beyond 30 characters.
3. Write a Shell program to enhance the inbuilt cal program as below
• Recognize the month by name
• Given one argument, prints the month or year’s calendar
• Given two arguments, should behave like cal, except for converting month names
into numbers
• Given zero arguments, should print the current month’s calender.
4. Write a Shell program to test whether a particular file exists
5. Write a Shell program to test whether a particular user is logged in
[ In a LAN environment write a shell program to keep track of users logging in
logging out ]
6. Write a Shell program that overwrites file.
7. WAP to check the file permissions of the file.
8. WAP that reads the user input and displays each argument separately.
9. WAP that calculates the gross salary of an employee
10. WAP that calculates the grade obtained by a student depending upon the marks
11. WAP to implement Linear Search
12. WAP to implement Insertion Sort
13. To check whether a no. entered at command line is prime or not.
14. To display on the screen the “ sorted” output of “who” along with the total no. of
users. The same output except the no. of users should also be sorted in file FILE1.
15. Display the multiplication table of the given number in the following format
2x1=2
2x2=4
.
.
.
2 x 12 = 24
16. Compare two given files, if the contents are same remove the second one.
17. Find the sum of the digits of the number entered at command line.
18. Merge the contents of three given files, sort the text contained in them and display the
sorted output on the screen page by page.
19. WAP that prints news files.
20. WAP that installs a file in the history. WAP extracts a file from history.
21. WAP that kills all processes matching a pattern. The program should verify that the
processes chosen by name are the ones that the user wants to kill.
22. To modify “cal “ command to be able to handle following input
$ cal jan mar nov
23. To modify “cal” command
$ cal jan….oct
24. To accept a login name. If not a valid login name give message “ “ is not a valid
name” “
25. To display date in the mm/dd/yyyy format. Eg. If date is 28-09-2002 then output of
the shell script should be Date 09/28/2002
JAVA SCRIPT

1. Write a script that prints the first n terms of Fibonacci Series.

2. Print the pattern as follows: (ask user for the no. of lines to be printed)
A
BB
CCC
DDDD
EEEEE

3. Print the pattern as follows: (ask user for the no. of lines to be printed)
1
22
333
4444
55555

4. Print the pattern as follows: (ask user for the no. of lines to be printed)
11111
2222
333
44
5

5. Write a script that outputs HTML text that displays in the HTML document a
checkerboard pattern as follows
********
********
********
********
********
********

6. Write a script that inputs five numbers and determines and outputs HTML text that
displays the number of negative number input, the number of positive numbers input
and the number of zeros input.

7. Write a script that reads in the size of the side of a square and outputs a HTML text
that displays a hollow square of that size out asterisks. Use a prompt dialogue to read
the size from the user. Your program should work for squares of all side sizes
between 1 and 20.

8. Use De Morgan’s Law to write equivalent expression for each of the following and
then write a program to show that the original expression and the new expression are
equivalent in each case
a. ! (x<5) && !(y>=7)
b. !(a==b) || !(g!=5)
c. !((x<=8) && y>4)
d. !((I>4) || (j<=6)
9. Write a script that prints the following diamond shape. You may use output statement
that print a single asterisk (*) a single space or a single newline character. Maximize
your use of repetition (with nested for structures) and minimize the number of output
statement.
*
***
*****
***
*

10. Write a function qualitypoints that inputs a student’s average and return 4 if a
student’s average is 90-100, 3 if the average is 80-92, 2 if the average is 70-79, 1 if
the average is 60-69 and 0 if the average is lower than 60. Incorporate the function
into a script that reads a value from the user. Display the result of the function in the
browser’s status bar.

11. Use a double-subscripted array to solve the following problem. Accompany has four
salespeople( 1 to 4 ) who sell five different products ( 1to 5). Once a day, each
salesperson passes in a slip for each different type of product actually sold. Each slip
contains.
a. the salesperson number
b. the product number, and
c. the total dollar value of that product sold that day.
Thus, each salesperson passes in between 0 and 5 sales slips per day. Assume that the
information from all of the slips for last month is available. Write a script that will
read all this information for last month’s sales and summarize the total sales by
salesperson by product. All totals should be stored in the double-subscripted array
sales. After processing all the information for last month, display the results in an
HTML table format with each of the columns representing a particular salesperson
and each of the rows representing a particular product. Cross total each row to get the
total sales of each product for last month; cross total each column to get the total sales
by salesperson for last month. Your tabular printout should include these cross totals
to the right of the totaled rows and to the bottom of the totaled columns.

12. Write a script that inputs a telephone number as a string in the form (555) 555-5555.
The script should use string method split to extract the area code as a token, the first
three digits of the phone number as a token and the last four digits of the phone
number as a token. Display the area code in one text field and the seven-digit phone
number in another text field.

13. Write a script that reads several lines of text and prints a table indicating the number
of one-letter words, two-letter words, etc. appearing in the text.

14. Write a script that breaks user entered text into words and prints them on different
lines in a text area.

You might also like