Advertisement

data structure 2nd solution fall 2009

Assignment

Q1. Convert the following infix expression into postfix

Infix Postfix
A + B-C*D

12 + 60 – 23

(A + B) ¬ (C ¬ D )

A ¬ B * C – D + E/F

12 + 60 + 23*35-2 AB + CD * -

1260 + 23 -

AB + CD - -

AB-CD- * EF / +

1260 + 2335 * + 2 -


Q2. Evaluate the following postfix expression using stack.
1 2 3 1   – 4 5 6 * + 7 * -
Write each step of this conversion using the following table.
Input Operator 1 Operator 2 value stack
1 1

2 2
1
3 3
2
1
1 1
3
2
1
 3 1 3 3
2
1
 2 3 8 8
1
- 1 8 7 7
4 1 8 7 4
7

5 1 8 7 5
4
7
6 1 8 7 6
5
4
7
* 5 6 30 30
4
7
+ 4 30 34 34
7
7 4 30 34 7
34
7
* 34 7 238 238
7
- 7 238 231 231


Evaluation of expression

1 2 3 1   – 4 5 6 * + 7 * -

1. Our first number is 1 , as 1 is operand so we will push it on the stack
2. The next element is 2 , which will be pushed on stack also. Now the recent most element is 2 in stack.
3. The next element is 3 , which will be pushed on stack also. Now the recent most element is 3 in stack.
4. The next element is 1 , which will be pushed on stack also. Now the recent most element is 1 in stack.
5. Now the next element is  , which is operator . Now we will pop two operands from stack which are 1 & 3 . The operator () will be applied to 1 and 3 and result (3) is written in value and pushed in stack also.
6. Now the next element is  , which is operator . Now we will pop two operands from stack which are 3 & 2 . The operator () will be applied to 3 and 2 and result (8) is written in value and pushed in stack also.
7. Now the next element is ( - ) which is operator . The operand 8 & 1 from stack will be popped out and (-) is applied to them. The most recent will be written in Operator 2 column and 1 in operator 1 column. The result ( 7) will be written in value column and pushed to stack also.
8. At this stage the most recent element is 7 , the next element in expression is 4.
As this is operand so it will be pushed to stack. Now the most recent is 4.
9. Now the next element is 5 , since it is also operand so it will be also pushed to
stack. Now the most recent is 5 in the stack and are placed like ( 5 , 4 & 7 ) respectively.
10. Now the next element is 6 , since it is also operand so it will be also pushed to
stack. Now the most recent is 6 in the stack and are placed like ( 6, 5 , 4 & 7 ) respectively.
11. Now in turn comes the operator ( * ) , the two most recent element is 6 & 5 .
Element 6 in Op2 column and 5 in Op1 column , the result (30) will be written in value and also pushed to stack.
12. Next element of expression is operator ( + ) , the two most recent element is
30 & 4 , so the result (34) is written in value column and also pushed to stack.
13. The next element in expression is 7 which is operand so it will be pushed to
top of stack and shown as ( 7 , 34 & 7 ) respectively. The 7 been the most
recent element in stack.
13. Now in turn comes the operator ( * ) , the two most recent element is 7 & 34 .
Element 7 in Op2 column and 34 in Op1 column , the result (238) will be written in value and also pushed to stack.
14. The last element in expression is operator (-) , the most recent element from the stack 238 and 7 are subtracted and the result ( 231) is written to the value and also in stack also.

231 = Answer

Assignment No.01 Semester: Fall 2009 CS402:Thoery of Automata Solution

Rules for Marking

It should be clear that your assignment will not get any credit if:

o The assignment is submitted after due date.

o The submitted assignment does not open

o The assignment is copied.

Objective

The objective of this assignment is to provide on hand experience of:

o Recursive definition of the language.

o Writing Regular Expression of the language.

o Building of Finite Automata (FA)

Assignment

Question No.1

a) Give a recursive definition for the language L, of strings containing the substring 00 defined over ∑= {0,1}.

b) Give a recursive definition for the language L, of positive integers divisible by 2 or 7

Solution:

a)

Recursive definition of language L, of strings containing the substring 00 defined over ∑= {0,1}.

Step 1

00 is in L

Step 2

x00x is also in L where x belong to {0,1}*

Step 3

No strings except those constructed in above, are allowed to be in L.

b)

Give the recursive definition of language L,of positive integers divisible by 2 or 7

Step 1

2 or 7 is in L

Step 2

2n or 7n are also in L where n = {1, 2, 3 …}

Step 3

No strings except those constructed in above, are allowed to be in L.

Question No. 2

Describe the languages (in English) defined over ∑={x,y} represented by the following regular expressions.

Solution:

Regular Expression

Regular Language

(x + y)* (x+y) (x + y)*

contains at least one x or y

(y)* x (y)* x (y)*

contains exactly 2 x,’s

(x + y)* x (x + y)* x (x + y)*

contains at least 2 x’s

(y)* x (y)* x (y)* + (x)* y (x)* y (x)*)

contains 2 x's or 2 y's

((y)* x (y)* x (y)* )*

contains even no. of x’s

Question No. 3

Construct a regular expression defining each of the following languages defined over Σ = {a,b}:

a) all strings that start with ‘a’ and have odd length, or start with ‘b’ and have even length

b) all strings that contain at least two b’s and at most one ‘a’

Solution:

a) a((a+b)(a+b))* + b((a+b)((a+b)(a+b))*)

b) bb+ + abb+ + b+ab+ + bb+a

Question No. 4

Build an FA over Σ={a, b} that only accepts the strings starting with ‘ab’.

Solution:

Assignment No.02 Semester: Fall 2009 CS402:Thoery of Automata

Rules for Marking

It should be clear that your assignment will not get any credit if:

o The assignment is submitted after due date.
o The submitted assignment does not open
o The assignment is copied.
Objective

The objective of this assignment is to provide on hand experience of:

o Building of Finite Automata (FA)
o Building of Transition Graph(TG)
o Finding Regular Expression (RE) corresponding to a Transition Graph (TG)
Assignment

Question:

Consider the EVEN-ODD language of strings, defined over ∑= {a,b}, having even number of a’s and odd number of b,s.

a) Build an FA for the given language
b) Build a Transition Graph (TG) that accepts the same language but has fewer states than FA.
c) Find the Regular Expression (RE) corresponding to TG accepting EVEN-ODD language (Show all possible steps)



Deadline
Your assignment must be uploaded/submitted on or before Nov 11,2009

Discuss at http://vuhelp.com/forum/viewtopic.php?f=5&t=91

Non Graded Assignment # 2 MTH302 (Fall 2009)

Very important Instructions

You do not need to submit the solution of this assignment.

This assignment is specially designed to introduce the style of the exam but just for telling the type of questions, the questions in the exam may not be as simple as in this assignment. Also we are only giving descriptive questions in this assignment, whereas for the practice of objective type questions, quiz will be given.

Solution of the assignment will be uploaded after one week. You can then compare your solution with the solution provided by us.

Question 1:

For the matrix, verify that


1) det (AB) =det (A).det(B)

2) det (A+B) ≠det (A)+det(B)

Question: 2

Three families P, Q and R share 480 kg of rice. Q receives twice as much as P and R receives half much rice as Q. How much rice does each family get?

Question: 3

In an automobile dealership, the most popular passenger cars are Brand A, B and C. Because buyers normally bargain for the best price, the average sales price for each brand is $20904, $11757, and $27859 respectively.

Table shows the sales for 3-month period.

Month

A

B

C

1

25

60

50

2

30

40

60

3

45

53

58

What are revenues from sale of Brands A, B and C for a 3-month period?

Question 4:

An item whose list price is Rs.500 is available at two successive discounts of Rs.10% and 20%.Find amount paid by the customer.

Question 5:

A jewelry chest costs Rs. 840 and has a 20% markup on the selling price.

Find the markup amount and the selling price of the chest.


Check at http://vuhelp.com/forum/viewforum.php?f=5
regards

CS 101 Introduction to Computing Assignment # 02 fall 2009

Deadline

Your assignment must be uploaded / submitted before or on November 10, 2009.

Marks = 15

Upload Instructions

Please view the assignment submission process document provided to you by the Virtual University to upload the assignment.

Rules for Marking

Please note that your assignment will not be graded if:

· It is submitted after due date

· The file you uploaded does not open

· The file you uploaded is copied from some one else or from internet

· It is in some format other than .html.

Objective

The assignment has been designed to enable you:

  • Understanding of HTML

Assignment

Build the following page using HTML





Instructions

1) Draw 3 single-line text input fields with labels First Name, Last Name and Email Address.

2) Draw two radio buttons Male and Female with label Gender and group them.

3) Draw 5 check boxes Cricket, Books, Music, Football and Internet under the label Hobbies.

4) Draw a drop down list with label City containing Lahore, Islamabad, Karachi and Rawalpindi in its options.

5) Create two buttons “Submit” and “Reset” of respective types.


NOTE: only one of the two radio buttons should be selected at a time. It means if user selects Female option then Male should be unselected automatically.

















Found Discussion at http://vuhelp.com/forum/viewtopic.php?f=10&t=88
regards

Assignment No. 02 Semester: Fall 2009 Data Warehousing Course Code: CS614

Deadline date:
Your assignment must be uploaded/submitted before or on November 10, 2009.

Assignment Marks: 20

Assignment Topic:
Topics covered in this assignment are basic data warehouse concepts.

Uploading instructions
Please view the assignment submission process document provided to you by the Virtual University to upload the assignment.

Rules for Marking
It should be clear that your assignment will not get any credit if:

o The assignment is submitted after due date
o The assignment is copied

Objective
o To learn and understand basic data warehouse concepts.
Problems

Q No. 1 20
An automobile Company XYZ has dealerships in different cities. These dealers provide products and services to their customers. Automobile company assesses their dealers with the feed back of their customers through e-mail. On the basis of this evaluation by the customers, Company XYZ makes a decision, whether dealers are providing proper services to their customers or not.
You are required to find the total attributes of all the relations used in this scenario, find the Facts for the fact table and also draw the star schema of the given scenario.

www.Vuhelp.com/forum

ASSIGNMENT 02 OF NUMERICAL ANALYSIS (MTH603)

MAXIMUM MARKS: 20
DUE DATE: NOV 11, 2009



DON’T MISS THESE Important instructions:
• To solve this assignment, you should have good command over 9-14 lectures.
• Upload assignments properly through LMS, No Assignment will be accepted through email.
• Write your ID on the top of your solution file.
• Don’t use colorful backgrounds in your solution file.
• Use Math Type or Equation Editor etc for mathematical symbols.

Question 1

Using Gaussian Elimination Method, solve the following system of equations

Marks: 10


Question 2


Do five iterations to solve the following system of equations by Gauss-Seidal iterative method

Assignment No. 02 Semester: Fall 2009 CS506: Web Design & Development

Instructions

Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

§ The assignment is submitted after due date.

§ The submitted assignment does not open or file is corrupt.

§ All types of plagiarism are strictly prohibited.

Note: You have to upload .java files and text file. Assignment in any other format (extension) will not be accepted. If you will submit code in .doc (Word document) you will get zero marks. You have to upload zip file if there are more than one file.

Objective

The objective of this assignment is to provide hands on experience of

§ Developing GUI application

§ Collections

§ Event handling

§ File Handling

§ Exception handling

Guidelines

§ Code should be properly aligned and well commented.

§ Follow java naming conventions for writing class names, variables names, function names etc

Assignment


Problem Statement:

You are required to develop a simple GUI (Graphical user interface) application for the registration of students in an institution. The program should be able to store the student data into a text file and when the user starts up the application again then previously stored data of student must also be saved into text file. The program should be able to handle events such as ActionEvent and ItemEvent.

The class Student must have following attributes:

  • Student Id
  • Student name
  • Student father’s name
  • Student age
  • Phone number
  • Study Program

The output of the GUI may be as given below:

The GUI must have labels, text boxes, combo box and buttons as shown in the figure below. The title of application must be displayed within center at the top of application.



In the above GUI application, when the user clicks ‘Register’ button then it will take the data from the form and store into text file. The application must quit by clicking ‘Exit’ button.

Deadline

Your assignment must be uploaded/submitted on or before 12th Nov, 2009

MGT301 - Principles of Marketing fall 2009

English Biscuits Manufacturers (EBM), established in 1965, is one of the important parts of Pakistan’s food industry and is considered to be the leader in the biscuits category. Ever since its establishment, it has introduced many biscuit brands such as Marie, Nice, Ringo and Smile getting extremely popular with the masses and became the important part of every household's Shaam ki chai. Keeping a keen eye on the market changes, EBM identified the need to develop sweet plain biscuit. Based on this insight, EBM introduced Sooper in 1996.

Initially Sooper was positioned to create the desire for bakery related products but it didn’t work. Sooper failed in terms of sales volume. In 2003, EBM decided to re-launch its struggling brand in a new color. They chose red color as opposed to the initially white colored packaging to give it a more vibrant and bright image. The first advertising communication after the re-launch focused on the taste of the product. If you can recall it was the humorous conversation between a mother and daughter with a play on the word “super”.

Questions:

1. Write down any substitute of Sooper?

2. Seeing various ads \ TVCs (TV commercials) of Sooper, what do you think is the target market of Sooper?

Find solution at

MARKET SEGMENTATION

A. Market Segmentation:
Markets consist of buyers, and buyers differ in one or more ways. They may differ in their wants,
resources, locations, buying attitudes, and buying practices. Through market segmentation,
companies divide large, heterogeneous markets into smaller segments that can be reached more
efficiently and effectively with products and services that match their unique needs. Companies
today recognize that they cannot appeal to all buyers in the marketplace, or at least not to all buyers
in the same way. Buyers are too numerous, too widely scattered, and too varied in their needs and
buying practices. Moreover, the companies themselves vary widely in their abilities to serve
different segments of the market. Rather than trying to compete in an entire market, sometimes
against superior competitors, each company must identify the parts of the market that it can serve
best and most profitably.
Thus, most companies are more selective about the customers with whom they wish to connect.
Most have moved away from mass marketing and toward market segmentation and targeting—
identifying market segments, selecting one or more of them, and developing products and
marketing programs tailored to each. Instead of scattering their marketing efforts firms are
focusing on the buyers who have greater interest in the values they create best.


Answer GDB of Marketing

1. Write down any substitute of Sooper?





2. Seeing various ads \ TVCs (TV commercials) of Sooper, what do you think
is the target market of Soope

contact at