Assignment 01 - FA24
Assignment 01 - FA24
Islamabad Campus
Department of Computer Science
FA2024 Page 1
Question # 1 (Static List)
Let L be a static list of n distinct elements. Write pseudocode(algorithm) that find all elements in given list
which have at-least two greater elements than themselves
Example:
Input: L [5] = {2, 8, 7, 1, 5};
Output: 2,1,5
Question # 2(Single Linked List)
Write pseudocode(algorithm) that prints alternate nodes of the given Linked List, first from head to end, and
then from end to head. If Linked List has even number of nodes, then skips the last node.
Question # 3(Single Linked List)
Write an algorithm that takes a simply linked list as input argument and modifies the list by moving the last
element to the front of the list.
Question # 4 (Circular Linked List)
Let sum1 and sum2 be the sum of even and odd nodes in a given circular linked list. Write an algorithm that
compute sum1 and sum2 and replace first and last node of given circular linked list with sum1 and sum2
respectively.
For example: Following is given input circular linked list:
7 11 9 3 4 8
sum1 = 22 sum2 = 20
22 11 9 3 4 20
FA2024 Page 2
As a software developer you decided to implement a linked list to manage these listings. Provide the data
structure design for the linked list and pseudocode to handle the following requirements:
1. Add a House Listing: Write a function to add a new house listing to the linked list. Each node in the
list should store the information from the 3x5 card.
2. Delete a House Listing: Write a function to delete a house listing from the linked list based on the
owner’s name.
3. Print Information by Owner’s Name: Write a function to search for and print the details of a house
listing given the owner's name.
4. Print Homeowners Alphabetically: Implement a function to print a list of all homeowners in
alphabetical order based on their names.
Question # 8
a) Draw a diagram of how List of List data structures might look both static and Linked List.
b) Write algorithms for insertion, deletion and display operations for above data structures.
FA2024 Page 3