Data Structures Laboratory (dsl) Codes

If the code doesn't load, you can check it out on GitHub

Group A

Q1: In second year computer engineering class, group A student’s play cricket, group B students play badminton and group C students play football. Write a Python program using functions to compute the following: a) List of students who play both cricket and badminton b) List of students who play either cricket or badminton but not both c) Number of students who play neither cricket nor badminton d) Number of students who play cricket and football but not badminton.


                

Q2: Write a Python program to store marks scored in the subject 'Fundamental of Data Structure' by N students in the class. Write functions to compute the following: a) The average score of class b) Highest score and lowest score of class c) Count of students who were absent for the test d) Display mark with highest frequency.


                

Q4: Write a Python program that computes the net amount of a bank account based on a transaction log from console input. The transaction log format is shown as following: D 100 W 200 (Withdrawal is not allowed if balance is going negative. Write functions for withdraw and deposit) D means deposit while W means withdrawal.


                

Group B

Q14: Write a Python program to store first year percentage of students in an array. Write functions for sorting the array of floating-point numbers in ascending order using: a) Selection Sort b) Bubble Sort Additionally, display the top five scores.


                

Q15: Write a Python program to store second year percentage of students in an array. Write functions for sorting the array of floating-point numbers in ascending order using: a) Insertion Sort b) Shell Sort Additionally, display the top five scores.


                

Q18: Write a Python program to store 10th class percentage of students in an array. Write a function for sorting array of floating point numbers in ascending order using radix sort and display top five scores.


                

Group C

Q19: Department of Computer Engineering has a student club named 'Pinnacle Club'. Students of second, third, and final year of the department can be granted membership on request. Similarly, one may cancel the membership of the club. The first node is reserved for the president of the club, and the last node is reserved for the secretary. Write a C++ program to maintain the club members' information using a singly linked list. Store student PRN and Name. Write functions to: a) Add and delete the members as well as the president or secretary. b) Compute the total number of club members. c) Display members. d) Concatenate two linked lists for two divisions.


                

Q23: Write a C++ program for storing binary numbers using doubly linked lists. Write functions: a) To compute 1's and 2's complement. b) To add two binary numbers.


                

Group D

Q25: A palindrome is a string of characters that‘s the same forward and backward. Write a C++ program with functions: a) To print original string followed by reversed string using stack b) To check whether given string is palindrome or not.


                

Q27: Implement a C++ program for expression conversion from infix to postfix and its evaluation using stack based on the following conditions: 1) Operands and operators must be single characters. 2) Input postfix expression must be in a desired format.


                

Group E

Q29: Queues are frequently used in computer programming, and a typical example is the creation of a job queue by an operating system. If the operating system does not use priorities, then the jobs are processed in the order they enter the system. Write a C++ program for simulating a job queue. Write functions to add a job and delete a job from the queue.


                

Q30: Write a program to implement a priority queue in C++ using an inorder list to store the items in the queue. Create a class that includes the data items (which should be template) and the priority (which should be int). The inorder list should contain these objects, with operator <= overloaded so that the items with highest priority appear at the start of the list (which will make it relatively easy to retrieve the highest item).


                

Q31: A double-ended queue (deque) is a linear list in which additions and deletions may be made at either end. Obtain a data representation mapping a deque into a one-dimensional array. Write a C++ program to simulate a deque with functions to add and delete elements from either end of the deque.