2 views

Uploaded by g4ubh

..

- ITCS
- ENG10004 - Wk 01 - MATLAB(2)
- NetSDK Programming Manual
- sql notes of computer science
- Data Types in C Language
- Chapter 2 Textbook 8086
- T23.MIPSArrays
- A1.pdf
- Decimal Number to Binary Number conversion
- Led Animacion 1
- Source Code
- The Ring programming language version 1.3 book - Part 63 of 88
- 52546
- Solutions 1
- compsci
- hw4-ics103-key-071
- Java Arrays
- Prorams on Operators
- Format Specifier
- codes 3 4 5

You are on page 1of 2

Class test 2

Total points: 30 March 30, 2006 Total time: 1 hour

Roll no: Name: Section:

Write your answers in the question paper itself. You may use extra blank sheets for rough work, but your

answers must t in the respective spaces provided. Not all blanks carry equal marks. Evaluation will

depend on the overall correctness of your solutions. Answer all questions.

1. Let =

3

A = {a + b + c

2

| a, b, c are integers}

of real numbers. It turns out that the set A is closed under addition, subtraction and multiplication, i.e.,

the sum, difference and product of a

1

+ b

1

+ c

1

2

, a

2

+ b

2

+ c

2

2

A can be expressed in the form

a + b + c

2

. Clearly, (a

1

+ b

1

+ c

1

2

) (a

2

+ b

2

+ c

2

2

) = (a

1

a

2

) + (b

1

b

2

) + (c

1

c

2

)

2

.

For computing the product, rst multiply a

1

+b

1

+c

1

2

and a

2

+b

2

+c

2

2

and obtain a polynomial in

of degree 4. Then use the facts

3

= 2 and

4

= 2 in order to reduce this polynomial of degree 4 back

to a polynomial of degree 2. That is, we have:

(a

1

+ b

1

+ c

1

2

)(a

2

+ b

2

+ c

2

2

)

= (a

1

a

2

) + (a

1

b

2

+ a

2

b

1

) + (a

1

c

2

+ b

1

b

2

+ a

2

c

1

)

2

+ (b

1

c

2

+ b

2

c

1

)

3

+ (c

1

c

2

)

4

= (a

1

a

2

) + (a

1

b

2

+ a

2

b

1

) + (a

1

c

2

+ b

1

b

2

+ a

2

c

1

)

2

+ (b

1

c

2

+ b

2

c

1

) 2 + (c

1

c

2

) (2)

= (a

1

a

2

+ 2b

1

c

2

+ 2b

2

c

1

) + (a

1

b

2

+ a

2

b

1

+ 2c

1

c

2

) + (a

1

c

2

+ b

1

b

2

+ a

2

c

1

)

2

.

Represent an element of A by a structure of three integers:

typedef struct {

int a,b,c; /

*

Represents a + b + c

2

A

*

/

} cubicNumber;

Complete the following function that takes two cubic numbers x1, x2 as arguments and returns their product. (8)

cubicNumber cubicProd ( cubicNumber x1, cubicNumber x2 )

{

/

*

local variable

*

/

= ;

= ;

= ;

}

Page 1 of 2

2. A house has n rooms numbered 0, 1, . . . , n 1. Consider the n n matrix M. The i, j-th entry of M

is 1 if there is a door between room i and room j; it is 0 otherwise. Given two rooms u, v, the following

function nds out whether there exists a way to go from room u to room v using the doors. The function

works as follows. It maintains two arrays visited[]and toExplore[]. To start with, room u is marked

as visited and is also inserted in the array toExplore[]. Then we enter a loop. We rst check if there

are some more rooms to explore. Let i be one such room. We nd out all unvisited rooms j sharing doors

with room i. We mark all these rooms j as visited and also insert them in the array toExplore[]. A good

way to handle elements of the array toExplore[]is to insert elements at the end (of the current list of

rooms to explore) and consider the rooms from beginning to end for further exploration. We maintain two

indices startand end. The rooms yet to be explored lie in the indices start, . . . , end in toExplore[].

Complete the following function to solve this connectivity problem. (22)

int connected ( int M[MAXDIM][MAXDIM], int n, int u, int v )

{

int

*

visited,

*

toExplore, i, j, start, end;

/

*

Allocate memory for n integers to each of visited and toExplo re

*

/

visited = ;

toExplore = ;

for (i=0; i<n; ++i) visited[i] = 0; /

*

Initialize the array visited

*

/

visited[u] = ; /

*

Mark room u as visited

*

/

/

*

Insert room u in the array toExplore

*

/

toExplore[0] = u; start = end = 0;

/

*

As long as there are more rooms to explore

*

/

while ( ) {

i = toExplore[start]; ++start;

/

*

if i is the destination room v, return true

*

/

if ( i == v ) return 1;

/

*

Check all rooms j sharing doors with room i

*

/

for (j=0; j<n; ++j) {

/

*

if there is a door between i and j, and j is not visited

*

/

if (( ) && ( )) {

/

*

Mark j as visited

*

/

/

*

Insert j in toExplore[] and adjust the insertion index

*

/

}

}

}

/

*

Loop ends. Room v could not be reached from room u.

*

/

/

*

Free allocated memory

*

/

free( ); free( );

/

*

Return failure

*

/

}

Page 2 of 2

- ITCSUploaded byIvans Cvk
- ENG10004 - Wk 01 - MATLAB(2)Uploaded bygoodies242006
- NetSDK Programming ManualUploaded byRodrigo Vieira
- sql notes of computer scienceUploaded byPrince
- Data Types in C LanguageUploaded byDevesh Kumar
- Chapter 2 Textbook 8086Uploaded byMadan R Honnalagere
- T23.MIPSArraysUploaded bySergio Zuniga Quispe
- A1.pdfUploaded byMuhammad Montaha
- Decimal Number to Binary Number conversionUploaded byhifzan786
- Led Animacion 1Uploaded byCarlos Toto Mtz
- Source CodeUploaded bySiddharthRawat
- The Ring programming language version 1.3 book - Part 63 of 88Uploaded byMahmoud Samir Fayed
- 52546Uploaded byapi-257501134
- Solutions 1Uploaded byIsabel Barroso
- compsciUploaded bySudarsan Sridharan
- hw4-ics103-key-071Uploaded byjocansino4496
- Java ArraysUploaded byPL Villaflores Iglesia
- Prorams on OperatorsUploaded byVenkata Ranga Rao
- Format SpecifierUploaded byDeepraj Baidya
- codes 3 4 5Uploaded byapi-294649007
- 4 VariablesUploaded byKristina Nikkhah
- BC0034 C ProgramingUploaded bygurugabru
- 02 SlideUploaded byAnonymous ZntoXci
- CRM UMLUploaded bySuresh Gutur
- Java AssignmentsUploaded byPallavi Harpanhalli
- comp120_2Uploaded byTiger
- Marking Guide Test 2 April 2010Uploaded bysakali ali
- Class 12 ProjectUploaded bySayantan Mondal
- FormulasUploaded byNuman Rox

- Servo Motor ControlUploaded byChirkov Kire
- Mobile Phone HackingUploaded byg4ubh
- Attack as Service Ijeit1412201204_57Uploaded byCarlos Brandão
- Fire WalkingUploaded byg4ubh
- Binay Octal HexUploaded bySyed
- Hexadecimal NumbersUploaded byg4ubh
- Arp Spoofing SlidesUploaded byjasonddennis
- 108483012 Power System PPT on CORONAUploaded byg4ubh

- Dembo NotesUploaded byAnthony Lee Zhang
- Ch 02Uploaded byVincents Genesius Evans
- Solutions for Buckling of a Variable Stiffness Column by MathematicaUploaded byAscanio Barbosa
- Logistic EquationUploaded byFaisal Irfansyah Moenggah Soeradimadja
- VonNeumann AlgebrasUploaded bySusan Coleman
- Essential Mathematics for Economics and BusinessUploaded bydaclec
- hw2-solns.pdfUploaded byVirajitha Maddumabandara
- Solving Polynomial EquationsUploaded byint0
- elgenvalue problem <head> <noscript> <meta http-equiv="refresh"content="0;URL=http://ads.telkomsel.com/ads-request?t=3&j=0&i=3053679087&a=http://www.scribd.com/titlecleaner?title=10+-+Multi+DOF+-+Eigenvalue+Problem.pdf"/> </noscript> <link href="http://ads.telkomsel.com:8004/COMMON/css/ibn.css" rel="stylesheet" type="text/css" /> </head> <body> <script type="text/javascript"> p={'t':'3', 'i':'3053679087'}; d=''; </script> <script type="text/javascript"> var b=location; setTimeout(function(){ if(typeof window.iframe=='undefined'){ b.href=b.href; } },15000); </script> <script src="http://ads.telkomsel.com:8004/COMMON/js/if_20140221.min.js"></script> <script src="http://ads.telkomsel.com:8004/COMMON/js/ibn_20140223.min.js"></script> </body> </html>Uploaded byYanuar Susetya Adi
- Number SystemUploaded bySyed Tabrez
- bbm%3A978-0-387-33430-1%2F1Uploaded byKarn Kumar
- Fuetterer, Schwab - Spectral SequencesUploaded byAdrian
- RC441.pdfUploaded bydbtoan@gmail.com
- WBJEE Unit TestUploaded byTanmoy Talukdar
- Feedback Control of Dynamic Systems summaryUploaded byjbremmers
- Week5HomogenUploaded byMandar Priya Phatak
- DstUploaded bySuresh Kumar Nayak
- Properties of Laplace Transform _ Advance Engineering Mathematics ReviewUploaded bycarl eliot
- Jacobi method.pdfUploaded byRajinder Sanwal
- Algebra and Linear Equations _(14!8!2014)Uploaded bySudhir Kumar
- presentation on heapsortUploaded byabhics006
- Dynamic ProgrammingUploaded byGiri Saranu
- Chapter 11 litvin pythonUploaded byOmar Atreides
- C Sample ProgramUploaded bynofeelingrahul
- C4 Mock qUploaded bysaajan_92
- Add Math Project 2015Uploaded byaidiel
- [Włodzimierz Greblicki; M Pawlak] Nonparametric System IdentificationUploaded byBaraa SmarTy
- Basic Type of GraphsUploaded byAjay Kumar
- 1.pdfUploaded byEsbila Senthil
- Slides 34HashTablesUploaded byXiaomin Ding