






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is solution to assignment for Aeronautical Engineering and Computer Programming course. It was submitted to Prof. Chitraksh Gavde at Biju Patnaik University of Technology, Rourkela. It includes: List, Doubly, Linked, Problem, Pointer, Programming, Procdure,Postcondition, Precondition, Loop, Else, Return
Typology: Exercises
1 / 10
This page cannot be seen from the preview
Don't miss anything!







10 11 13
head
type Listnode is record Element : Elementtype; Next : Listptr; Prev : Listptr; -- this is the change made to singly linked lists end record;
10 11 13
head
Initial State
10 11 13
head Previous^ Current
12
When loop is exited^ NewNode
Current.Prev := NewNode
10 11 13
12
NewNode
head Previous Current
Package Specification
GNAT 3.15p (20020523) Copyright 1992-2002 Free Software Foundation, Inc.
Checking: c:/docume~1/jayaka~1/mydocu~1/16070/code/doubly_linked_list.ads (source file time stamp: 2004-03-31 20:46:40)
-- Specification for doubly-linked lists
-- Specified: Jayakanth Srinivasan
-- Last Modified: February 11, 2004
package Doubly_Linked_List is
subtype Elementtype is Integer;
type Listnode;
type Listptr is access Listnode;
type Listnode is
record
Element : Elementtype;
Next : Listptr;
Prev : Listptr; -- this is the change made to singly linked lists
end record;
type List is
record
Head : Listptr;
end record;
procedure Makeempty (
L : in out List );
-- Pre: L is defined
-- Post: L is empty
function Isempty (
L : in List )
return Boolean;
-- Pre: L is defined
-- Post: returns True if L is empty, False otherwise
procedure Display (
L : in List );
-- Pre: L may be empty
-- Post: displays the contents of L's Element fields, in the
-- order in which they appear in L
procedure Initialize (
L : in out List );
-- Pre: L may be empty
-- Post: Elements inserted into the list at correct position
procedure Insert_In_Order (
L : in out List;
Element : in Elementtype );
end Doubly_Linked_List;
54 lines: No errors
Package Implementation
GNAT 3.15p (20020523) Copyright 1992-2002 Free Software Foundation, Inc.
Compiling: c:/docume~1/jayaka~1/mydocu~1/16070/code/doubly_linked_list.adb (source file time stamp: 2004-03-31 20:48:14)
108 lines: No errors
Test Program
GNAT 3.15p (20020523) Copyright 1992-2002 Free Software Foundation, Inc.
Compiling: c:/docume~1/jayaka~1/mydocu~1/16070/code/doubly_list_test.adb (source file time stamp: 2004-03-31 20:49:02)
27 lines: No errors