Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

COMSATS University, Islamabad

Islamabad Campus
Department of Computer Science

Read before Attempt


Assignment No. 1:
Course code and Title: CSC211, Data Structure and Algorithm
Instructor: Tanveer Ahmed
Assigned Date: February 24, 2020 Due Date: March 4,2020
Total Marks: -- CLO-1:
Instructions:
1. This is an individual assignment. You will submit your work individually through your logins
(course portal)
2. Try to get the concepts, consolidate your concepts and ideas from these questions
3. You should concern recommended books for clarify your concepts as handouts are not
sufficient.
4. Try to make solution by yourself and protect your work from other
students. If I found the solution files of some students are same, then I will
reward zero marks to all those students.
5. Deadline for this assignment is March 4,2020. This deadline will not be extended.

Question # 1 (Static List)


Let L be a static list of n distinct elements. Design an 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)
Design an 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 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:

SP2020 Page 1
7 11 9 3 4 8

Question # 5 (Double Linked List)


Let k be a given integer value. Write an algorithm that search two nodes in double linked list whose sum is
equal to k.
Question # 6 (Double Circular Linked List)
Write an algorithm that delete duplicate node from given circular doubly linked list.

a) Draw a diagram of how List of List data structures might look both static and Linked List.
b) Write algorithms/ routines to implement the appropriate operations for of each implementation of
above data structures

SP2020 Page 2

You might also like