dsa

© All Rights Reserved

8 views

dsa1

dsa

© All Rights Reserved

- Advanced Data Structures and Algorithms
- Introduction.to.Algorithms
- BTech II Year Electronics Syllabus (Effective From 2017-18)
- AbdullahAshfaq L3 Linked Lists
- IYrBTechR13ModelPaper
- Algorithms
- Arrays (Solved)
- Exam3_REVIEW_CSCI1302.doc
- DSs&as - Intro
- Stack Ques
- c and Data Structures Q and A
- Apt
- Data Structure
- 15csl38-Data Structures Lab Manual
- Lab Manual (1)
- SORTING AND SEARCHING
- What is Data Structure
- Unit 3
- RecitationEight (7)
- DS Syllabus(Autonomous)

You are on page 1of 9

TimeLeft=1:34:54

1

You want to find the nth element of a set of

numbers. If you store the numbers in a list

_________________ ?

Finding the nth element is faster if it was stored in an array 3Mark

Finding the nth element takes the same amount of time across

all data structures

Finding the nth element is slower if it was stored in a hash

table

Finding the nth element is slower if it was stored in an array

2

Let S and S1 be two stacks and Q be the additional

Queue then what is the result after following pseudo

code is executed:

while (S not empty)

{

Q.insert(pop(S));

}

while(Q not empty)

{

push(S1,Q.delete());

} ?

S and S1 are same 6Mark

None of them

S and S1 will be different

S1 is reverse of S

Page 1 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

3

Algorithms A and B solve the same problem. Time

complexity of A is in O(n^2) and that of B is in O(n).

Which among the following can you guarantee? ?

A is having more executable instructions than B 3Mark

A is having less number of functions than B

A is having less executable instructions than B

A is having more number of functions than B

4

Assume that you have a very large array of elements.

You are required to sort this array. The main

contraint here is the space rather than time. Which

among the following algorithm is not an ideal

choice? ?

Merge Sort 3Mark

Insertion Sort

Bubble Sort

Quick Sort

5

Think about a server to which all ATM clients of a

particular bank is connected. There are requests

coming from different ATM centers and the server

has to verify the user name and password and do the

transaction also. There could be successful and

failure requests. There could be requests from other

banks? ATM also. Some customers may spend more

time than others.

Which all data structures could be involved for

implementing the same? Conceptualize your answer.

Would you go for an array implementation or linked

list implementation? Justify your answer. ?

4Mark

Page 2 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

6

Minimum how many stacks are needed to implement

a queue ?

Cannot be implemented 3Mark

2

3

1

7

Which among the following is true for doubly linked

list ?

The left pointer of the right most node and right pointer of the

left most node are null

3Mark

The left pointer of the left most node and right pointer of the

right most node are null

The right pointer of the right most node and no condition on

the left most node

The left pointer of the right most node and no condition on the

left most node

unsigned int str_hash(unsigned char *string,

unsigned int buckets, unsigned in alphabet_size,

unsigned int hash_limit)

{

int i = 0;

unsigned int accum;

while ((string[i] != 0) && (i < hash_limit))

i++;

if (i < hash_limit)

Page 3 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

8

hash_limit = i;

accum = (unsigned int) string[hash_limit - 1];

for (i = hash_limit - 2; i >= 0; i--)

accum = string[i] + (accum * alphabet_size);

return accum % buckets;

}

What is this function trying to do?

Note: buckets is the array size which is a prime

number, alphabet_size is the number of all possible

characters, hash_limit is the length of a string and

string is a string. ?

4Mark

9

A quicksort algorithm is used to sort an array of N

elements.If all the N values were 0 then what would

be the time complexity of quicksort that uses first

element as the pivot. ?

O(1) 6Mark

O(N)

O(N log N)

O(N*N)

10

Which among the following are applications of

queues ?

Queues keep track of processes waiting for a turn in the CPU 3Mark

Queues keep track of events waiting to be handled, like

multiple button clicks

Queues are used in parsing

Page 4 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

Queues are used for evaluation of arithmetic expressions

11

Let S be the original stack and S1 and S2 the two

additional stacks then the following pseudo code is to

reverse the stack S:

while (S not empty)

{

push(S1,pop(S));

}

while(S1 not empty)

{

push(S2,pop(S1));

}

while(S2 not empty)

{

push(S,pop(S2));

} ?

True 6Mark

False

Not Answer

12

The hash function is

H1(k) = k % 50.

In the case of collision, the hash function used is

H(k) = (H1(k) + M x H2(k)) % 50

where H1(k) = k % 50 and H2(k) = k % 20.

M is initialized to 0 and is incremented by 1 each

time a collision occurs.

This could be categorized under which of the

following collision detection technique? ?

Linear Probing 3Mark

Page 5 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

Re-Hashing

Quadratic Probing

Double Hashing

13

What does the following function return, if q

contains the address of the first element in a linked

list

int function(NODE *q)

{

int c = 0;

while( q != NULL)

{

q = q->link;

c++;

}

return (c);

} ?

The value of the first elements of the linked list 4Mark

The number of elements in a linked list

The value of the last node of the linked list

The address of the last element of the linked list

14

Consider the following set of integers.

{20,25,57,48,37,12,92,86,33}

If one uses the quick sort algorithm to sort the above

set of integers, how many pivot values are required

to completely sort the file?

Note: you may choose middle element as a pivot. ?

3 3Mark

5

8

9

Page 6 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

15

The time complexity of insertion sort in worst case

is? ?

n(n+1)/4 3Mark

n(n+1)/2

n(n-1)/4

n(n-1)/2

16 Linear Search is best for ... ?

Small arrays 3Mark

Small or Large, but sorted arrays

Small or Large, but unsorted arrays

Large arrays

17

Assume that a structure for a Binary Search Tree

exists.

What does the following function do?

int function(root)

{

current = root;

while (current->left != NULL)

{

current = current->left;

}

return(current->data);

} ?

6Mark

What does the following function do if S is an array

used to implement a stack

Page 7 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

18

float peep ( float S[], int *t, int i)

{

float val;

if( (*t-i+1) > 0)

{

val = S[*t-i+1];

return val;

}

} ?

Returns the value at the top of the stack 4Mark

Returns the ith value from top of the stack

It gives a compilation error

Returns the value at the ith postion of the array

19 The disadvantage of Binary Search is ?

It may not work for strings 3Mark

Its performance depends on the position of the search element

in the array

It has the overhead of sorting

It may not work for floating point numbers

20 Subjective Question to be done on server ?

4Mark

21

int MFunc(tree *T)

{

int N1,N2;

if(T == NULL)

return -1;

N1 = MFunc(T->left);

Page 8 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

N2 = MFunc(T->right);

return (N1 > N2 ? N1 : N2) + 1;.

}

If T points to root of a tree, what does this function

do? Explain. ?

4Mark

22

Which is the best data structure for round robin

algorithm for CPU scheduling? ?

Queue implemented using stacks 5Mark

Doubly linked list

Circular queue

Stack implemented using queues

submit

Page 9 of 9

2/6/2009 http://10.203.161.13/OES/take.jsp?s1=506&s2=20302

- Advanced Data Structures and AlgorithmsUploaded byToaster97
- Introduction.to.AlgorithmsUploaded bydiego
- BTech II Year Electronics Syllabus (Effective From 2017-18)Uploaded byAnonymous eWMnRr70q
- AbdullahAshfaq L3 Linked ListsUploaded byabdullah1996
- IYrBTechR13ModelPaperUploaded byRammohanreddy Rajidi
- AlgorithmsUploaded bychemlrajsunny
- Arrays (Solved)Uploaded byVo Thanh Vinh
- Exam3_REVIEW_CSCI1302.docUploaded byErwin Gunawan
- DSs&as - IntroUploaded bynaeema_58
- Stack QuesUploaded byRaffi Sk
- c and Data Structures Q and AUploaded byAnandaKrishna Sridhar
- AptUploaded bySACHIN VERMA
- Data StructureUploaded byAshwin Kumar
- 15csl38-Data Structures Lab ManualUploaded byAbubaker Siddique
- Lab Manual (1)Uploaded byhania dogar
- SORTING AND SEARCHINGUploaded byᗬᗴᐻ ᔤᗩᕼᕢᖆᘍ
- What is Data StructureUploaded byKaruna Karan
- Unit 3Uploaded byAkram Mohammed
- RecitationEight (7)Uploaded byAnonymous yTb1V5m
- DS Syllabus(Autonomous)Uploaded bygdeepthi
- MCA_3_yearUploaded byshanu
- experiments of data structure.docxUploaded byNikita
- Solution MTEUploaded byManoj Kumar Choudhary
- 02 Sorting (Chap 13)Uploaded byfrankjamison
- 110Uploaded byHello mister
- Data StructuresUploaded byGarima Prabhakar
- Data Structure-Intrvw QuesUploaded bypranav
- 8ThreadsInC.pdfUploaded bySimo Bouna
- Assessment Test - FIVS CDO Suite.docxUploaded byRajput Sarvesh Singh
- KPLOverview.pdfUploaded byBryan Dayawan

- CSR ActivitiesUploaded bymichaelgodfather
- se1Uploaded bymichaelgodfather
- dsa2Uploaded bymichaelgodfather
- seUploaded bymichaelgodfather
- MBA CAT Test Series Schedule 2013Uploaded byRichard Gaurab
- DsaUploaded bymichaelgodfather
- cste1Uploaded bymichaelgodfather
- cst1Uploaded bymichaelgodfather
- csre1Uploaded bymichaelgodfather
- cs1Uploaded bymichaelgodfather
- csreUploaded bymichaelgodfather
- csUploaded bymichaelgodfather
- CreUploaded bymichaelgodfather
- c1Uploaded bymichaelgodfather
- cUploaded byamitvit3
- Telecom 11Uploaded bymichaelgodfather
- Telecom Set3Uploaded bymichaelgodfather
- Telecom Set2Uploaded bymichaelgodfather
- Telecom Set1Uploaded bymichaelgodfather
- SocketUploaded bymichaelgodfather
- ProgramsUploaded bymichaelgodfather
- Eecs 140 Vhdl TutorialUploaded byОлег Гребеников
- Digital Electronics PDFUploaded bySruthy Arun
- diffformUploaded bymrignal
- 100 Popular Idioms From Chez RaginiakUploaded byBurak Öğüt
- digital electronicsUploaded byananth163

- Data Structure.pptxUploaded byMuhammad Ali
- avl treeUploaded bysaiteja1234
- MIT6_046JS15_pset7solsUploaded byram
- Longest Increasing SubsequenceUploaded bychetram
- Lecture 3Uploaded bywerhmeister
- 06Uploaded byDebranjan Pal
- Solve Linear Programming Problems - MATLABUploaded bysam54
- Rao Algorithms- Three Metaphor-less Simple Algorithms for Solving Optimization ProblemsUploaded byQuan Nguyen
- 1-DAA-Intro.pdfUploaded byharry_i3t
- Data Structure QuestionsUploaded byviswasknit
- Boosting & AdaboostUploaded bySuperquant
- Tutorial-5.pdfUploaded byAnimesh Choudhary
- 05 Combinatorial GamesUploaded byPratik Jain
- Clustering.pdfUploaded byDragos Popescu
- Qp Mca Sem3 May11Uploaded byVarsha Singh
- Fast Fourier TransformsUploaded byPradosh K. Roy
- AOA exp1Uploaded bySakharam Gawade
- Divide and ConquerUploaded byzxcvbnmzxcvbnm
- Mid-Point Circle AlgorithmUploaded bykamar
- To Implement Boundary Fill Algorithm.docxUploaded bySanjayLulla
- AVL TreesUploaded byHanadi Dkheel
- L11_OptimizationUploaded byJesús Cisneros Jr.
- Hanouts SimplexUploaded byVineet Harit
- NTU CE2001Uploaded byClark Carey
- 05AdvTopicsSorting.pdfUploaded bySugar Plums
- JavaUploaded byThilinaAbhayarathne
- Traditional genetic algorithms use only one crossover and one mutation operator to generate the next generation. The chosen crossover and mutation operators are critical to the success of genetic algorithms. Different crossover or mutation operators, however, are suitable for different problems, even for different stages of the genetic process in a problem.Uploaded byAbcbatata666
- LVQUploaded bymac_p_c
- Recursion in C,C++Uploaded bysabarisri
- 11-recursionUploaded byabhi231594