Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Data Structure Visualization DSV Viva Stack Tree Graph Test Practice

Beoordeling
-
Verkocht
-
Pagina's
21
Cijfer
A+
Geüpload op
30-05-2025
Geschreven in
2024/2025

Data Structure Visualization DSV Viva Stack Tree Graph Test Practice

Voorbeeld van de inhoud

DSA Viva Stack Tree Graph Test Practice
2025-2026
1. Given the following sequence of letters and asterisks:

(a) Consider the stack data structure, supporting two operations push and pop, as discussed in
class. Suppose that for the above sequence, each letter (such as E) corresponds to a push of that
letter onto the stack and each asterisk (*) corresponds to a pop operation on the stack. Show the
sequence of values returned by the pop operations.



(b) Consider the queue data structure, supporting two operations insert and remove, as discussed
in class. Suppose that for the above sequence, each letter (such as E) corresponds to an insert of
that letter into the queue and each asterisk (*) corresponds to a remove operation on the queue.
Show the sequence of values returned by the remove operations.

Answer:
a).Answer for stack Output: SYEUQTSAONIE.
b).Answer for Queue Output: EASYQUESTION

2. Suppose you were asked to write a method that will take two sorted stacks A and B (min on top)
and create one stack that is sorted (min on top). You are allowed to use only the stack operations
such as pop, push, size and top. No other data structure such as arrays are not allowed. You are
allowed to use stacks. Note that elements on the stack can be compared using compareTo.

Public Stack mergeSortedStacks(Stack A, Stack B)
{
…...
}
Answer:

,3. Evaluate the postfix expression: 10 5 + 60 6 / * 8 -

, Answer :142

4. Write a recursive delete method for singly-linked lists with integer data that deletes the
first occurrence of a given integer from the list and returns the resulting list.
class ListNode
{
private int value; //data value
Public ListNode next; //next element of list, or null if last
public ListNode(int v)
{
value = v;
}
public int value()
{
return value;
}
}

Answer :
static ListNode delete(int i, ListNode s)
{
if (s == null)
return s;
if (s.value() == i)
return s.next;
s.next = delete(i, s.next);
return s;
}

5. If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push
(2), pop are performed on a stack, then what will be the sequence of popped out values?

Answer:




Question 6 :-Suppose you want to get from s to t on weighted graph G with
nonnegative edge weights, but you would like to stop by u if it isn’t too
inconvenient. (Here too inconvenient means that it increases the length of

Documentinformatie

Geüpload op
30 mei 2025
Aantal pagina's
21
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

  • dsv viva stack exams
$13.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Exammate Indiana University Of Pennsylvania
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
62
Lid sinds
4 jaar
Aantal volgers
8
Documenten
3200
Laatst verkocht
1 week geleden
The plug

You cannot simultaneously prevent and prepare for war. Albert Einstein We'd love to hear how satisfied you are with your order. Please take a moment to leave a review, Thank you.

2.7

10 beoordelingen

5
1
4
2
3
3
2
1
1
3

Populaire documenten

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen