Docsity

Problem Set: Doubly Linked Lists and Graph Algorithms, Exercises of Computer Engineering and Programming

Toggle sidebar
bg1
CP5_6
The problems in this problem set cover lectures C5 and C6.
1.
a. What are doubly linked lists? What is the record declaration for a node in a doubly
linked list? (hint: see Feldman page 672, problem 8)
b. Write an algorithm to insert a node into a sorted doubly linked list. Use a diagram to
show the sequence of operations that have to be performed to carry out the insertion step.
Hint: Extend the approach used in class/ notes for singly linked lists.
c. Implement your algorithm as an Ada95 program.
Assume:
i. The data field consists of a single integer.
Turn in a hard copy of your algorithm and code listing, and an electronic copy of your
code.
2. What is the Shortest Path through the graph shown below using Dijkstra’s algorithm?
Show all the steps in the computation of the shortest path.
b
e
a
c
d
1
2
10
5
7
3 2 9 4 6
3. Define the following terms (as applied to graphs):
a. Walk
b. Path
c. Eulerian Path
d. Cycle
e. Degree of a vertex
docsity.com

Partial preview of the text

Download Problem Set: Doubly Linked Lists and Graph Algorithms and more Exercises Computer Engineering and Programming in PDF only on Docsity!

CP5_

The problems in this problem set cover lectures C5 and C6.

a. What are doubly linked lists? What is the record declaration for a node in a doubly linked list? (hint: see Feldman page 672, problem 8)

b. Write an algorithm to insert a node into a sorted doubly linked list. Use a diagram to show the sequence of operations that have to be performed to carry out the insertion step.

Hint: Extend the approach used in class/ notes for singly linked lists.

c. Implement your algorithm as an Ada95 program.

Assume: i. The data field consists of a single integer.

Turn in a hard copy of your algorithm and code listing, and an electronic copy of your code.

  1. What is the Shortest Path through the graph shown below using Dijkstra’s algorithm? Show all the steps in the computation of the shortest path.

b e

a

c d

  1. Define the following terms (as applied to graphs): a. Walk b. Path c. Eulerian Path d. Cycle e. Degree of a vertex

docsity.com