3. a. Show the stack after each operation of the following sequence that starts with the empty stack: push(a), push(b), pop, push(c), push(d), pop b. Show the queue after each operation of the following sequence that starts with the empty queue: enqueue(a), enqueue(b), dequeue, enqueue (c), enqueue(d), dequeue

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

#3

ing data items with a collect on of
illustrations of this notion, reread, say, our definitions of the priority queu
dictionary. Although abstract data types could be implemented in older procedu-
ral languages such as Pascal (see, e.g., [Aho83]), it is much more convenient to
do this in object-oriented languages such as C++ and Java, which support abstract
data types by means of classes.
Exercises 1.4
1. Describe how one can implement each of the following operations on an array
so that the time it takes does not depend on the array's size n.
a. Delete the ith element of an array (1 ≤ i ≤n).
b. Delete the ith element of a sorted array (the remaining array has to stay
sorted, of course).
2. If you have to solve the searching problem for a list of n numbers, how can you
take advantage of the fact that the list is known to be sorted? Give separate
answers for
a. lists represented as arrays.
b. lists represented as linked lists.
3. a. Show the stack after each operation of the following sequence that starts
with the empty stack:
push(a), push(b), pop, push(c), push(d), pop
b. Show the queue after each operation of the following sequence that starts
with the empty queue:
enqueue(a), enqueue (b), dequeue, enqueue (c), enqueue (d), dequeue
4. a. Let A be the adjacency matrix of an undirected graph. Explain what prop-
erty of the matrix indicates that
i. the graph is complete.
ii. the graph has a loop, i.e., an edge connecting a vertex to itself.
iii. the graph has an isolated vertex, i.e., a vertex with no edges incident
to it.
b. Answer the same questions for the adjacency list representation.
5. Give a detailed description of an algorithm for transforming a free tree into
a tree rooted at a given vertex of the free tree.
Transcribed Image Text:ing data items with a collect on of illustrations of this notion, reread, say, our definitions of the priority queu dictionary. Although abstract data types could be implemented in older procedu- ral languages such as Pascal (see, e.g., [Aho83]), it is much more convenient to do this in object-oriented languages such as C++ and Java, which support abstract data types by means of classes. Exercises 1.4 1. Describe how one can implement each of the following operations on an array so that the time it takes does not depend on the array's size n. a. Delete the ith element of an array (1 ≤ i ≤n). b. Delete the ith element of a sorted array (the remaining array has to stay sorted, of course). 2. If you have to solve the searching problem for a list of n numbers, how can you take advantage of the fact that the list is known to be sorted? Give separate answers for a. lists represented as arrays. b. lists represented as linked lists. 3. a. Show the stack after each operation of the following sequence that starts with the empty stack: push(a), push(b), pop, push(c), push(d), pop b. Show the queue after each operation of the following sequence that starts with the empty queue: enqueue(a), enqueue (b), dequeue, enqueue (c), enqueue (d), dequeue 4. a. Let A be the adjacency matrix of an undirected graph. Explain what prop- erty of the matrix indicates that i. the graph is complete. ii. the graph has a loop, i.e., an edge connecting a vertex to itself. iii. the graph has an isolated vertex, i.e., a vertex with no edges incident to it. b. Answer the same questions for the adjacency list representation. 5. Give a detailed description of an algorithm for transforming a free tree into a tree rooted at a given vertex of the free tree.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education